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 xuguangshengqq at 2007-01-26 10:55:46 on Problem 1129
#include <iostream.h>


void main(){
  int min = 0;
  char a[27];
  int b[26];
  int i,j,n;
  
   while(cin>>n&&n){
	   for(i=0;i<=n-1;i++){b[i] = 1;}
     for(i=1;i<=n;i++)
	 { 
	   cin>>a;
       j = 2;
	   while(a[j])
	   {
		   //if(a[j]>a[0])
		   //{
		    if(b[(int)a[0]-65]==b[(int)a[j]-65])
				b[(int)a[j]-65]++;
		   //} 
		   j++;
	   }
	 }min = 0;
     for(i=0;i<=n-1;i++){if(min<b[i])min = b[i];}
     if(min==1){cout<<"1 channel needed.\n";}
	 else cout<<min<<" channels needed."<<endl;

   }
}

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