| ||||||||||
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:谁给看一下,我的代码哪错了,测试数据是正确的,可是总过不了In Reply To:谁给看一下,我的代码哪错了,测试数据是正确的,可是总过不了 Posted by:578579544 at 2011-03-02 22:08:13 > #include <iostream> > #include <algorithm> > using namespace std; > char a[27][27]; > int b[26]; > > int main() > { > //freopen("in.txt","r",stdin); > int n,i,j,p,q,min; > while(scanf("%d",&n)&&n!=0) > { > memset(a,0,sizeof(a)); > for(i=0;i<n;i++) > scanf("%s",a[i]); > for(i=0;i<26;i++) > b[i]=1; > for(i=0;i<n;i++) > { > for(j=2;j<=n&&a[i][j]!=0;j++) > { > p=a[i][j]-65; > q=a[0][j]-65; > if(a[i][j]<a[i][0]) > continue; > if(b[p]==b[q]) > b[p]++; > } > } > > min=*max_element(b,b+sizeof(b)/sizeof(b[0])); > if(min==1) > printf("%d channel needed.\n",min); > else > printf("%d channels needed.\n",min); > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator