| ||||||||||
| 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 | |||||||||
帮我看看,我到底错在哪里啊#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main(){
long int a[100000];
char s[20];
int l=0,m=0,n,i,j,k,t=0;
int b[26]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9,0};
scanf("%d",&n);
while(1)
{scanf("%s",s);
a[l]=0;
m=strlen(s);
for (i=0;i<m;i++)
if (!(s[i]=='-') && !(s[i]=='Q') && !(s[i]=='Z'))
{if (s[i]<='9') a[l]=a[l]*10+(s[i]-'0');
else a[l]=a[l]*10 +(b[s[i]-'A']);
}
l+=1;
if (l==n) break;
}
sort(a,a+n);
for(i=0;i<n;i++)
{j=0;k=i;
do
{j+=1;
k+=1;
}
while(a[k]==a[i]);
i=i+j-1;
if (!(j==1)) {t=1;printf("%ld-%ld %d\n",a[i]/10000,a[i]%10000,j);}
}
if (t==0) printf("No duplicates.\n");
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator