POJ1002
来源:互联网 发布:藤井莉娜的淘宝店 编辑:程序博客网 时间:2024/06/05 22:55
//
// main.cpp
// JudgeTest
//
// Created by 彭凌群 on 2017/8/3.
// Copyright © 2017年 彭凌群. All rights reserved.
//
#include <iostream>
#include <map>
#include <vector>
#include<algorithm>
#include <string>
using namespace std;
char num[] = {
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
};
int convertStr(char* a)
{
char len = (char)strlen(a);
int ret = 0;
for (char c = 0; c < len; ++c)
{
if (a[c] >= '0' and a[c] <= '9') {
ret = ret * 10 + a[c] - '0';
}
else if(a[c] >='A' and a[c] < 'Z' and a[c] != 'Q')
{
ret = ret * 10 + num[a[c] - 'A'];
}
}
return ret;
}
void test1002()
{
unsigned int loopCount = 0;
cin >> loopCount;
char oriNO[80];
map<int,int> mt_map;
bool ok = false;
for(int i = loopCount; i; --i)
{
cin >> oriNO;
int key = convertStr(oriNO);
if (mt_map[key]) {
++mt_map[key];
ok = true;
}
else
{
mt_map[key] = 1;
}
}
if (not ok) {
cout << "No duplicates." << endl;
return;
}
for (map<int,int>::iterator it = mt_map.begin(), itEnd = mt_map.end(); it != itEnd; ++it)
{
if (it->second>1) {
printf("%03d-%04d %d\n", it->first/10000, it->first%10000, it->second);
}
}
}
int main() {
test1002();
return 0;
}
- POJ1002
- POJ1002
- poj1002
- poj1002
- poj1002
- poj1002
- poj1002
- POJ1002
- poj1002
- POJ1002
- POJ1002
- POJ1002
- poj1002
- POJ1002
- POJ1002
- poj1002
- poj1002
- POJ1002
- 安卓高手之路之(架构设计)
- 新浪微博视频下载教程
- jfinal 开发笔记
- 安卓高手之路之PackageManagerservice
- 十大必须掌握的机器学习算法,你都知道了吗?
- POJ1002
- 商品列表获取数据ajax clone 分页
- 欢迎使用CSDN-markdown编辑器
- SQL中PIVOT 行列转换;UNPIVOT列转行
- 安卓高手之路之PackageManagerservice(二)
- Python(21):用web.py搭一个服务端
- 母牛的故事
- 安卓高手之路之java层Binder
- 我理解的剑指offer----字符串的全排列和组合算法