中易网

做ACM在本地能通过,但是上传总是报错Wrong Answer,题目在http://poj.org/problem?id=1002

答案:2  悬赏:40  
解决时间 2021-01-29 20:32
#include
#include
#include
using namespace std;

string insert(string &s1,string &s2,int n)
{
string tem(s1.begin(),s1.begin()+n);
string tem1(s1.begin()+n,s1.end());
tem+=s2;
return tem+tem1;
}

string judge(string Phone)
{
for (int j=0;j {
if (Phone.at(j)>='A'&&Phone.at(j)<='C')
{
Phone[j]='2';
}
else if(Phone.at(j)>='D'&&Phone.at(j)<='F')
{
Phone[j]='3';
}
else if(Phone.at(j)>='G'&&Phone.at(j)<='I')
{
Phone[j]='4';
}
else if(Phone.at(j)>='J'&&Phone.at(j)<='L')
{
Phone[j]='5';
}
else if(Phone.at(j)>='M'&&Phone.at(j)<='O')
{
Phone[j]='6';
}
else if(Phone.at(j)>='P'&&Phone.at(j)<='S'&&Phone.at(j)!='Q')
{
Phone[j]='7';
}
else if(Phone.at(j)>='T'&&Phone.at(j)<='V')
{
Phone[j]='8';
}
else if(Phone.at(j)>='W'&&Phone.at(j)<='Y')
{
Phone[j]='9';
}

else if(Phone.at(j)>='0'&&Phone.at(j)<='9')
Phone.at(j);

}
for (int j=0;j {
if(Phone[j]=='-')
{
for (int i=j+1;i {
Phone[i-1]=Phone[i];
}
Phone[Phone.length()-1]='\0';
}
}

string insertx="-";
Phone=insert(Phone,insertx,3);
char phonenum[9];
for(int i=0;i<8;i++)
{
phonenum[i]=Phone[i];
}
phonenum[8]='\0';
string phone1="";

phone1=(string)phonenum;
return phone1;
}

int main()
{
map wordCount;
map phone;
string word;
string word1;
static long num;
cin>>num;
while (num--)
{
cin>>word;
word1="";
word1=judge(word)+"\0";

++wordCount[word1];

}

int x=0;
for (map::iterator it = wordCount.begin();it != wordCount.end(); ++it)
{
if ((*it).second>1)
{

cout<<(*it).first<<" "<<(*it).second< x=1;
}
}
if(x==0)
cout<<"No duplicates."<
return 0;}
最佳答案
给你一个数据哦:
2
---3333--3-3-3--
-3333333

输出:
333-3333 2
你好好检查一下吧
全部回答
我是来看评论的
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
三天之内石家庄去西安有山西好走还是河南好走
五菱荣光b12变速箱挂倒档跳到一档位置
2011年10月1日国庆节是第几周年
魔耳国际英语(牡丹江穆棱市)怎么去啊,有事要
杭州西湖酥鱼好吃吗?哪里买可以啊?尝尝
安庆文明城市排名第几名?
做室内设计是要多久才能入行?
我儿患有抽动症多年已十四岁能治好吗
求解决:疑似在英雄联盟中的木马病毒
苹果手机上面的微信信息怎么样可以第一时间就
有哪些关于美食的节目
得安凉茶黄阁分店地址在什么地方,想过去办事
在不同级的地方买的车性能会不会相同
大家说说天机7玩王者荣耀卡是中兴还是腾讯优
宁波镇海植物园梅墟坐几路公交
推荐资讯
万古不变是什么
买3个足球5个篮球共562元买3个足球和8个篮球
请问这截图里的机器人是哪部电影里的
溧阳昆仑花园1区的房子什么价位
怎样看在线江南电影院
10句话随机,从第一句开始依次随,概率都该写
少女时代9个人分别叫什么名字?谁的人气最高
0.125的100次方乘以8的101次方简便计算
吊兰哪一个部分吸收水份
7又40分之21等于几分之几
工伤超过年龄后怎么办?
长沙226公交车到不到高铁站
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?