Moderator: Board moderators
else if ( s[i] == 'O' || s[i] == 'N' || s[i] == 'O' || s[i] == '6' )
4
5
-0-0-0-0-1-0-1
IYSDS-1-1-
MMDPS-22
0000A--AA
-----AMSAM--AA
6
3-10-10-1A
6464642
ASACCS5
-1111115
F101010
888-1200
5
-5-5-9-7-4-9-2
2947955
GO-HOME-1
HOME-123
12344-AA
9
-123-5657
12----12121
ABBCSS1
12112-A--B
ABBC-123
-1-2----3AABC
KKSDS-AA
ALNKNDS
----KKJ1234
No duplicates.
No duplicates.
No duplicates.
No duplicates.
printf("%3d-%4d",temp/10000,temp%10000);
printf(" %ld\n",count);
printf("%03ld-%04ld",temp/10000,temp%10000);
printf(" %ld\n",count);
#include <iostream>
#include <string>
#include <map>
using namespace std;
long t[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};
long table[128];
long convert(string &s)
{
long n=s.length();
long ret=0;
long i;
for(i=0;i<n;i++)
{
if(s[i]!='-')
ret=ret*10+table[s[i]];
}
return ret;
}
void InitTable()
{
unsigned char i;
for(i=0;i<128;i++)
{
if(i>='0'&&i<='9')
table[i]=i-'0';
else
if(i>='A'&&i<='Z')
table[i]=t[i-'A'];
}
}
void main()
{
InitTable();
long ncase;
string s;
long tel;
long occu;
long n;
cin>>ncase;
map<long,long> telmap;
map<long,long>::iterator ptr,end;
cout.fill('0');
while(ncase-->=1)
{
cin>>n;
telmap.clear();
while(n-->=1)
{
cin>>s;
telmap[convert(s)]++;
}
ptr=telmap.begin();
end=telmap.end();
bool dup=false;
while(ptr!=end)
{
if(ptr->second!=1)
{
dup=true;
cout.width(3);
tel=ptr->first;
cout<<tel/10000<<'-';
cout.width(4);
cout<<tel%10000<<' ';
cout<<ptr->second<<endl;
}
ptr++;
}
if(!dup)
cout<<"No duplicates."<<endl;
if(ncase!=1)
cout<<endl;
}
}
Users browsing this forum: No registered users and 1 guest