求救,80pts,第三组第五组RE。
查看原帖
求救,80pts,第三组第五组RE。
687794
Han1034666650楼主2022/11/23 09:37

评测记录

#include<bits/stdc++.h>
using namespace std;
int n;
map<int,string>q;
map<string,int>cm;
map<string,bool>check;
string h[100001];
int have;
int main()
{
	q[65]="2";q[66]="2";q[67]="2";q[80]="7";q[82]="7";q[83]="7";
	q[68]="3";q[69]="3";q[70]="3";q[84]="8";q[85]="8";q[86]="8";
	q[71]="4";q[72]="4";q[73]="4";q[87]="9";q[88]="9";q[89]="9";
	q[74]="5";q[75]="5";q[76]="5";
	q[77]="6";q[78]="6";q[79]="6";
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		string answer;bool xg=0;
		char ch[15];
		int number=0;
		cin>>ch;
		int len=strlen(ch);
		for(int j=0;j<len;j++)
		{
			int op=ch[j];
			if(ch[j]>='0'&&ch[j]<='9')answer+=ch[j],number++;
			if(ch[j]>='A'&&ch[j]<='Z')answer+=q[ch[j]],number++;
			if(number==3&&xg==0)
			{
				number=0;
				xg=1;
				answer+="-";
			}
		}
		h[have++]=answer;
		cm[answer]++;
	}
	bool flag=0;
	sort(h+1,h+1+have);
	for(int i=1;i<=have;i++)
	{
		if(cm[h[i]]>1&&check[h[i]]==0)
		{
			cout<<h[i]<<" "<<cm[h[i]]<<endl;
			flag=1;
			check[h[i]]=1;
		}
	}
	if(!flag)cout<<"No duplicates.";
	return 0;
}
2022/11/23 09:37
加载中...