Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
436611 叶梓皓 【C7-2】找树根 C++ 解答错误 0 2 MS 236 KB 355 2026-04-17 21:23:57

Tests(0/3):


#include<bits/stdc++.h> using namespace std; int a[110]; int n,f,ma=INT_MIN,s,j=1,a1[110]; int main(){ cin>>n; int x,y; for(int i=1;i<=n-1;i++){ cin>>x>>y; s=x; a[x]++; if(a[x]>ma){ ma=a[x]; f=x; a1[j]=y; j++; } } cout<<s<<endl; cout<<f<<endl; for(int i=1;i<j;i++){ cout<<a1[i]<<" "; } return 0; }


测评信息: