#include <iostream> using namespace std; int main(void) { int num, check, high = 1; cin>>num; int tree[num][3]; tree[0][0] = 0; tree[0][1] = 0; tree[0][2] = 1; for(int i=1; i<num; i++){ cin>>tree[i][0]>>tree[i][1]; } for(int i=1; i<num; i++){ for(int j=0; j<num; j++){ if(tree[i][0]==tree[j][1]) tree[i][2] = tree[j][2]+1; } if(high<tree[i][2]) high = tree[i][2]; } cout<<high<<endl; return 0; } 惹惹惹...
点赞 评论

相关推荐

Gardenia06...:刚开始学是这样的,可以看看左神和灵神都讲的不错
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务