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

简单的贪心

Posted by 20130760237 at 2015-09-17 08:07:39 on Problem 1129
//memory 360k
//time  0ms
int main()
{
	int num;
	char sta[28][28];
	int channel[28];
	while(scanf("%d",&num)!=EOF&&num)
	{
		int result=1;
		for(int i=1;i<=num;i++)   channel[i]=1;
		char *p=&sta[0][1];
		gets(p);
		for(int i=1;i<=num;i++)
		{
			p=&sta[i][1];
			gets(p);
		//	puts(p);
		}
		for(int i=1;i<=num;i++)
		{
			int k;
			for(int j=3;sta[i][j]!='\0';j++)
			{
				k=sta[i][j]-'A'+1;
				if(k>i)
				channel[i]++;
			}
		}
		
		for(int i=1;i<=num;i++)
		{
		   if(result<channel[i])
		     result=channel[i];	
		}
		if(result==1)
		    printf("1 channel needed.\n");
		else
		    printf("%d channels needed.\n",result);
		
    }
}

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