| ||||||||||
| 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阿#include <iostream>
#include <string>
#include <list>
using namespace std;
list <string> M;
string s;
string make()
{
string t=" ";int j=0;
for (int i=0;i<s.size();i++)
{
if (s[i]!='-')
{
if (s[i]>=65&&s[i]<=67) t[j]='2';
else
if (s[i]>=68&&s[i]<=70) t[j]='3';
else
if (s[i]>=71&&s[i]<=73) t[j]='4';
else
if (s[i]>=74&&s[i]<=76) t[j]='5';
else
if (s[i]>=77&&s[i]<=79) t[j]='6';
else
if (s[i]>=80&&s[i]<=83) t[j]='7';
else
if (s[i]>=84&&s[i]<=86) t[j]='8';
else
if (s[i]>=87&&s[i]<=89) t[j]='9';
else
t[j]=s[i];
j++;
}
}
return t;
}
int main()
{
int N;
cin>>N;
int flag=0;
for (int i=0;i<N;i++)
{
cin>>s;
M.push_back(make());
}
M.sort();s=M.front();
M.pop_front();int num=1;
while (!M.empty())
{
if (M.front()==s) num++;
else
{
if (num>1)
{cout<<s[0]<<s[1]<<s[2]<<"-"<<s[3]<<s[4]<<s[5]<<s[6]<<" "<<num<<endl;
flag=1;}
num=1;
}
s=M.front();
M.pop_front();
}
if (flag==0) 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