Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
哪位大牛帮我看看呀,我这样做为什么WA呀????急急急........#include "stdio.h" int number[50001] = {0}; int main() { int a,b,n,i; scanf("%d",&n); for( i = 1 ; i < n ; i++ ) { scanf("%d%d",&a,&b); number[a]++; number[b]++; } int pisition = 1; int time = number[1] ; for( i = 2 ; i <= 50000 ; i++ ) if( number[i] >= time ) { pisition = i; time = number[i] ; } for( i = 1 ; i < pisition ; i++ ) if( number[i] == time ) printf("%d ",i); printf("%d\n",pisition); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator