满江红求助!
  • 板块P2037 电话号码
  • 楼主Dcchen
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/8/1 22:15
  • 上次更新2024/8/2 08:48:40
查看原帖
满江红求助!
1012241
Dcchen楼主2024/8/1 22:15
#include<iostream>
#include<string.h>
#include<map> 
using namespace std;
int n,a[100005],cnt=0;
string s;
const int stdd[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};
map<int,int> mp;
map<int,bool> v;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		int x=0;
		cin>>s;
		for(int j=1;j<=s.size();j++){
			if(s[j]>='A'&&s[j]<='Z'){
				s[j]=stdd[s[j]-'A'];
			}
			if(s[j]>='0'&&s[j]<='9'){
				s[j]=s[j]-'0';
			}
			x=x*10+int(s[j]);
		}
		mp[x]++;
		a[++cnt]=x;
	}
	bool flag=0;
	for(int i=1;i<=n;i++){
		if(!v[a[i]]&&mp[a[i]]>1){
			cout<<a[i]<<' '<<mp[a[i]];
			flag=1;
			v[a[i]]=1;
		}
	}
	if(!flag) cout<<"No duplicates.";
}
2024/8/1 22:15
加载中...