| ||||||||||
| 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 | |||||||||
Re:请各位高手看一看,为啥俺的代码老是WAIn Reply To:请各位高手看一看,为啥俺的代码老是WA Posted by:xuguangshengqq at 2007-01-26 10:55:46 > #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator