您的位置:首页 > 其它

POJ_1002_487-3279

2016-08-27 09:11 363 查看
#include<cstdio>
#include<cstdlib>
#include<cctype>
#include<map>

using namespace std;

int main(){
int n, num, flag;
char str[300], ch;

map<int, int> counts;
map<int, int>::iterator it;

scanf("%d", &n);
while (n--){
num = 0;
scanf("%s", str);
for (int j = 0, k = 0; j < 7; k++){
ch = str[k];
if (isdigit(ch)){
j++;
num = num * 10 + ch - '0';
} else if (isupper(ch)){
j++;
num = num * 10 + (ch - 'A' - (ch > 'Q')) / 3 + 2;
}
}
counts[num]++;
}

flag = 0;
for (it = counts.begin(); it != counts.end(); it++){
if (it->second > 1){
printf("%03d-%04d %d\n", it->first / 10000, it->first % 10000, it->second);
flag = 1;
}
}
if (flag == 0)
printf("No duplicates.\n");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  POJ 1002 487-3279