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 LCL_data at 2007-07-25 14:41:37 on Problem 3282
#include<stdio.h>
#include<string.h>
void main()
{
   char a[10000][6];
   int s[10001],mark[10000];
   int n,l,m,i,j,k=0;
   int left_t=0,right_t=0;
   scanf("%d",&n);
   for(i=0;i<n;i++)
   {
	   left_t=0;right_t=0;
	   scanf("%d %d",&l,&m);
	   for(j=0;j<m;j++)
	   {
		   scanf("%d %s",&s[j],a[j]);
		   mark[j]=0;
	   }

	   
	   for(j=0;j<m-1;j++)
	   {
		   for(k=j+1;k<m;k++)
		   {
			   if(mark[j]==0&&mark[k]==0&&(!strcmp(a[j],a[k]))&&s[j]+s[k]<=l*100) 
			   {
			    s[j]=s[j]+s[k];
			    mark[k]=1;
			   }
		   }
		   
	   }
//	 for(j=0;j<m;j++)
 // printf("%d !!%s!! %d\n",s[j],a[j],mark[j]);

	   for(j=0;j<m;j++)
	   {
		   if(a[j][0]=='l'&&mark[j]==0) left_t++;
		   if(a[j][0]=='r'&&mark[j]==0) right_t++;
	   }
	  //   printf("2*left_t-1=%d 2*right_t= %d\n",2*left_t-1,2*right_t);
	   if(left_t>right_t) 
		   printf("%d\n",2*left_t-1);
	   else 
		   printf("%d\n",2*right_t);

   }
}

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