| ||||||||||
| 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,请大牛帮忙看看!!!!!!!!!!!!!!!//我的代码如下:
#include<iostream>
#include<cstring>
using namespace std;
const int MAX=10001;
int main()
{
int n,i,j,count=0,b=0,k=0,a[MAX]={0},cal=0;
//freopen("in.txt","r",stdin);
char temp[MAX]={0};
char s[MAX][50]={0};
char c[MAX][50]={0};
cin >> n;
for(i=0;i<n;i++)
{
cin >> c[i];
for(j=0;j<strlen(c[i]);j++)
{
if(c[i][j]=='A'||c[i][j]=='B'||c[i][j]=='C')
c[i][j]='2';
else if(c[i][j]=='D'||c[i][j]=='E'||c[i][j]=='F')
c[i][j]='3';
else if(c[i][j]=='G'||c[i][j]=='H'||c[i][j]=='I')
c[i][j]='4';
else if(c[i][j]=='J'||c[i][j]=='K'||c[i][j]=='L')
c[i][j]='5';
else if(c[i][j]=='M'||c[i][j]=='N'||c[i][j]=='O')
c[i][j]='6';
else if(c[i][j]=='P'||c[i][j]=='R'||c[i][j]=='S')
c[i][j]='7';
else if(c[i][j]=='T'||c[i][j]=='U'||c[i][j]=='V')
c[i][j]='8';
else if(c[i][j]=='W'||c[i][j]=='X'||c[i][j]=='Y')
c[i][j]='9';
}
for(j=0;j<strlen(c[i]);j++)
if(c[i][j]=='0'||c[i][j]=='1'||c[i][j]=='2'||c[i][j]=='3'||c[i][j]=='4'||c[i][j]=='5'||c[i][j]=='6'||c[i][j]=='7'||c[i][j]=='8'||c[i][j]=='9')
s[i][b++]=c[i][j];
for(j=6;j>=3;j--)
{
s[i][j+1]=s[i][j];
if(j==3) {s[i][j]='-';break;}
}
b=0;
}
for(j=0;j<n;j++)
for(i=j+1;i<n;i++)
if(strcmp(s[j],s[i])>0)
{
strcpy(temp,s[j]);
strcpy(s[j],s[i]);
strcpy(s[i],temp);
}
for(j=0;j<n;j++)
{
if(strcmp(s[j],"0")!=0)
{
for(i=j+1;i<n;i++)
{
if(strcmp(s[j],s[i])==0)
{
k++;
memset(s[i],'0',sizeof(s[i]));
}
}
if(k>0) cout << s[j] << " "<< (k+1) << endl;
else a[cal++]=k+1;
k=0;
}
}
int flag=1;
for(i=0;i<n;i++)
{
if(a[i]!=1) {flag=0;break;}
}
if(flag==1) cout << "No duplicates." << endl;
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator