| ||||||||||
| 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 | |||||||||
为什么这代码WA的?EXAMPLE过得了的#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int cmp ( const void *a , const void *b )
{
return *(int *)a - *(int *)b;
}
int main()
{
int N,I,a[100000],temp,i,j,n;
char d,c[8],len;
scanf("%d",&N);
for (I=0;I<N;I++)
{
j=0;
while (j<7)
{
d=getchar();
if (d>='0'&&d<='9') c[j]=d;
else if (d>='A'&&d<'Z'&&d!='Q')
{
if (d<='P') c[j]=(d-'A')/3+'2';
else c[j]=(d-'Q')/3+'7';
}
else continue;
j++;
}
c[7]='\0';
a[I]=atoi(c);
}
qsort(a,N,sizeof(a[0]),cmp);
for (I=1,temp=a[0],n=1,j=0;I<N;I++)
{
if (a[I]==temp)
{
j=1;
n++;
if (I!=N-1) continue;
}
else if (n>1) printf ("%03d-%04d %d\n",temp/10000,temp%10000,n);
n=1;
temp=a[I];
}
if (j==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