|
|
back to boardWA 14 please help, give me some exemples if descendant(A,B)==true, if A is descendant for B int level(int X) == level of vertex with number X, level(root)==0 my code: ... for (i=0;i<L;i++) { int a,b; scanf("%i %i",&a,&b); if (a==b){printf("0\n");continue;} if (level(a)<level(b)) { if (descendant(b,a)) printf("1\n"); else printf("0\n"); } else { if (descendant(a,b)) printf("2\n"); else printf("0\n"); } } WHY I got WA14? please help me |
|
|