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:SOS:谁能帮我看一下哪出错了?(最好能给出检测数据)In Reply To:SOS:谁能帮我看一下哪出错了?(最好能给出检测数据) Posted by:sidy at 2007-03-18 12:18:04 > #include<stdio.h> > char a[1025][1005],result[1005]; > int b[26]; > char c[1025]; > int main(){ > int n,l,i,j,k,count,temp,temp2; > while(scanf("%d%d",&n,&l) && n!=0){ > for(i=0; i<n; i++){ > scanf("%s",&a[i]); > } > for(i=0; i<1005; i++)result[i]=' '; > count=0; > for(i=0; i<l; i++){ > for(j=0; j<26; j++)b[j]=0; > for(j=0; j<n; j++)b[a[j][i]-'A']++; > temp=0; temp2=0; > for(j=0; j<26; j++){ > if(temp<=b[j]){ > temp=b[j]; > temp2=j; > } > } > result[i]='A'+temp2; > printf("%c",result[i]); > count=count+n-temp; > } > for(i=0; i<l; i++){ > for(j=0; j<n; j++){ > c[j+1]=a[j][i]; > } > for(j=1; j<=n; j*=2){ > for(k=j; k<=n; k=k+2*j){ > if(c[k]==c[k+j] && c[k]!=result[i]){c[k+j]=c[k]; count--; } > else c[k+j]=result[i]; > } > } > } > printf(" %d\n",count); > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator