-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1002.cpp
More file actions
46 lines (46 loc) · 885 Bytes
/
1002.cpp
File metadata and controls
46 lines (46 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<iostream>
#include<iomanip>
using namespace std;
int cmp( const void *a , const void *b )
{
return *(int *)a - *(int *)b;
}
main(){
int *a,ai;
int i,n,t,m,tc;
int ans=0;
char c[100];
const int b[26]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9};
cin>>n;
a=new int[n];
ai=0;
m=n;
while(m--){
cin>>c;
t=i=0;
while(c[i]){
if(c[i]=='-'){i++;continue;}
if(c[i]<='Z'&&c[i]>='A')t=t*10+b[c[i]-'A'];
else t=t*10+c[i]-'0';
i++;
}
a[ai++]=t;
}
qsort(a,n,sizeof(int),cmp);
t=-1;
tc=0;
for(i=0;i<n;i++){
if(a[i]==t)tc++;
else {
if(tc>1){
cout<<setfill('0')<<setw(3)<<t/10000<<"-"<<setfill('0')<<setw(4)<<t%10000<<" "<<tc<<endl;
ans=1;
}
t=a[i];
tc=1;
}
}
if(tc>1){ans=1;cout<<setfill('0')<<setw(3)<<t/10000<<"-"<<setfill('0')<<setw(4)<<t%10000<<" "<<tc<<endl;}
if(!ans)cout<<"No duplicates."<<endl;
return 1;
}