| ||||||||||
| 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:各位高手帮忙看看;为啥是WA?In Reply To:各位高手帮忙看看;为啥是WA? Posted by:90305113 at 2004-01-01 15:58:59 > #include <stdio.h>
> void main(){
> char a[100][7],b;
> int n,i,j,x,s=0,p=1,d[100],r=0,k,q;
> long int w[100][2];
> scanf("%d",&n);
> for(i=0;i<n;i++){
> for(j=0;j<7;j++){
> scanf("%c",&b);
> if(b>=48&&b<=57) a[i][j]=b;
> else if(b>=65&&b<=67) a[i][j]='2';
> else if(b>=68&&b<=70) a[i][j]='3';
> else if(b>=71&&b<=73) a[i][j]='4';
> else if(b>=74&&b<=76) a[i][j]='5';
> else if(b>=77&&b<=79) a[i][j]='6';
> else if(b>=80&&b<=83) a[i][j]='7';
> else if(b>=84&&b<=86) a[i][j]='8';
> else if(b>=87&&b<=99) a[i][j]='9';
> else j=j-1;
> }
> }
> for(i=0;i<n;i++) d[i]=1;
> for(i=0;i<n;i++){
> if(a[i][0]=='e') continue;
> else {
> for(j=i+1;j<n;j++){s=0;
> for(x=0;x<7;x++){
> if(a[i][x]==a[j][x]) s=s+1;
> }
> if(s==7) {
> a[j][0]='e';
> d[i]=d[i]+1;
> d[j]=0;
> }
> }
> }
> }
> for(i=0;i<n;i++){
> w[i][0]=0;
> if(a[i][0]!=101&&d[i]>1){
> r=1;
> for(j=0;j<7;j++)
> w[i][0]=(a[i][j]-48)+w[i][0]*10;
> }
> }
> for(q=0;q<n;q++){k=0;for(j=0;j<n;j++){if(w[k][0]==0)k++;
> else break;}
> for(i=0;i<n;i++){
>
> if(w[i][0]!=0&&w[k][0]>w[i][0])k=i;
> }
>
> if(a[k][0]!=101&&d[k]>1){
> for(j=0;j<3;j++)
> printf("%c",a[k][j]);
> printf("-");
> for(j=3;j<7;j++)
> printf("%c",a[k][j]);
> printf(" %d\n",d[k]);
> }w[k][0]=0;
> }
>
> if(r==0) printf("No duplicates. \n");
>
> }
>
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator