| ||||||||||
| 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 | |||||||||
体现一下STL 的强大#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#define MAXN 200001
#define MOD 1000000007
#define INF 0x7fffffff
#define EPS 1e-8
#define PI acos(-1.0)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define bug(a) cout<<"bug---->"<<a<<endl;
#define FIN freopen("datain.txt","r",stdin);
#define FOUT freopen("dataout.txt","w",stdout);
#define mem(a,b) memset(a,b,sizeof(a))
//#pragma comment (linker,"/STACK:102400000,102400000")
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;
int main()
{
int n;
map<char,string> mmap;
map<string,int> dic;
mmap['A']="2";
mmap['B']="2";
mmap['C']="2";
mmap['D']="3";
mmap['E']="3";
mmap['F']="3";
mmap['G']="4";
mmap['H']="4";
mmap['I']="4";
mmap['J']="5";
mmap['K']="5";
mmap['L']="5";
mmap['M']="6";
mmap['N']="6";
mmap['O']="6";
mmap['P']="7";
mmap['R']="7";
mmap['S']="7";
mmap['T']="8";
mmap['U']="8";
mmap['V']="8";
mmap['W']="9";
mmap['X']="9";
mmap['Y']="9";
while(scanf("%d",&n)!=EOF)
{
for(int i=0;i<n;i++)
{
string s,st;
cin>>s;
for(int j=0;j<s.size();j++)
{
if(s[j]!='-')
{
if(s[j]>='0'&&s[j]<='9')
st+=s[j];
else
st+=mmap[s[j]];
}
if(st.size()==3)
st+='-';
}
//st+='\0';
dic[st]++;
}
int ok=1;
for(map<string,int>::iterator it=dic.begin();it!=dic.end();it++)
if((*it).second>1)
{
cout<<(*it).first<<" "<<(*it).second<<endl;
ok=0;
}
if(ok)
printf("No duplicates.\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator