#include <stdio.h> #include <string.h> int s[22]={0}; int main() { int n; int a,b; while(scanf("%d",&n)!=EOF) { memset(s,0,sizeof(s)); int i; for(i=0;i<n;i++) { scanf("%d%d",&a,&b); s[a]=b; } int ac=0,bc=0; int ai=1; while(s[ai]!=0) { ai=s[ai]; ac++; } ai=2; while(s[ai]!=0) { ai=s[ai]; bc++; } if(ac>bc) { printf("You are my elder\n"); } if(ac<bc) { printf("You are my younger\n"); } if(ac==bc) { printf("You are my brother\n"); } } return 0; }
时间: 2024-11-09 00:31:23