1 #include2 #include 3 using namespace std; 4 const int maxn = 105; 5 struct Node 6 { 7 int father; 8 int level; 9 bool NoChild;10 };11 12 Node v[maxn];13 int level[maxn];14 15 int main()16 {17 int N,M,i,j,c,ID,child;18 int MAXLevel = 1;19 scanf("%d%d",&N,&M);20 for(i=0;i<100;i++)21 {22 v[i].father=0;23 v[i].level=0;24 v[i].NoChild=1;25 }26 for(i=0;i MAXLevel)46 MAXLevel = v[j].level;47 }48 }49 50 for(i=1;i<=N;++i)51 if(v[i].NoChild==1)52 level[v[i].level]++;53 for(i=1;i