Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位大牛帮我看看呀,我这样做为什么WA呀????急急急........

Posted by linyuetian at 2007-03-11 10:26:22 on Problem 3107
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator