中航长江建设工程有限公司网站,深圳互联网设计公司,网络营销的实现方式包括,长安镇仿做网站传送门 文章目录题意#xff1a;思路#xff1a;题意#xff1a; 思路#xff1a;
可以发现树的直径起点和终点一定是两个度数为111的点#xff0c;所以我们可以把kkk平均的分给所有度数为111的点#xff0c;这样答案就为2∗kcnt\frac{2*k}{cnt}cnt2∗k。 证如果分配给…传送门
文章目录题意思路题意 思路
可以发现树的直径起点和终点一定是两个度数为111的点所以我们可以把kkk平均的分给所有度数为111的点这样答案就为2∗kcnt\frac{2*k}{cnt}cnt2∗k。 证如果分配给其他的点的话那么直径一定是经过这个被多余分配出的点这样得出来的直径一定将这个点的值平均分配给度数为111的点的时候的直径。
//#pragma GCC optimize(2)
#includecstdio
#includeiostream
#includestring
#includecstring
#includemap
#includecmath
#includecctype
#includevector
#includeset
#includequeue
#includealgorithm
#includesstream
#includectime
#includecstdlib
#define X first
#define Y second
#define L (u1)
#define R (u1|1)
#define pb push_back
#define mk make_pair
#define Mid (tr[u].ltr[u].r1)
#define Len(u) (tr[u].r-tr[u].l1)
#define random(a,b) ((a)rand()%((b)-(a)1))
#define db puts(---)
using namespace std;//void rd_cre() { freopen(d://dp//data.txt,w,stdout); srand(time(NULL)); }
//void rd_ac() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//AC.txt,w,stdout); }
//void rd_wa() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//WA.txt,w,stdout); }typedef long long LL;
typedef unsigned long long ULL;
typedef pairint,int PII;const int N1000010,mod1e97,INF0x3f3f3f3f;
const double eps1e-6;int n;
int d[N];
double k;int main()
{
// ios::sync_with_stdio(false);
// cin.tie(0);cinnk;for(int i1;in-1;i){int a,b; scanf(%d%d,a,b);d[a]; d[b];}int cnt0;for(int i1;in;i) cnt(d[i]1);printf(%.6f\n,2*k/cnt);return 0;
}
/**/