# Bzoj4726 [poi2017]sabota_

## 非套路题

Posted by yjjr's blog on April 6, 2018

# 题目

## Sample Input

9 3
1
1
2
2
2
3
7
3


## Sample Output

0.6666666667


# code

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define mem(x,num) memset(x,num,sizeof x)
#define reg(x) for(int i=last[x];i;i=e[i].next)
using namespace std;
ll f=1,x=0;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
const int maxn=5e5+6;
struct edge{int to,next;}e[maxn<<1];
int last[maxn],cnt,n,k,size[maxn];double f[maxn],ans=0;
void insert(int u,int v){
e[++cnt]=(edge){v,last[u]};last[u]=cnt;
}
void dfs(int x){
size[x]++;
bool flag=0;
reg(x)dfs(e[i].to),size[x]+=size[e[i].to],flag=1;
if(!flag){f[x]=1;return;}
reg(x)f[x]=max(f[x],min(f[e[i].to],(double)size[e[i].to]/(double)(size[x]-1)));
}
int main()
{