POJ1002
来源:互联网 发布:javascript sha1函数 编辑:程序博客网 时间:2024/05/08 11:30
#include <iostream>#include <vector>#include <algorithm>using namespace std;const int map[] = {2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9};int main(){ bool flag = true; int i,j,n,num,size,left,right,count; char input[16]; char * pin; vector<int> pho; cin >> n; while (n--) { cin >> input; pin = input; num = 0; while (*pin) { if (*pin <= '9'&&*pin >= '0') num = num * 10 + *pin - '0'; if (*pin <= 'Y'&&*pin >= 'A') num = num * 10 + map[*pin - 'A']; pin++; } pho.push_back(num); } sort(pho.begin(), pho.end()); size = pho.size(); i = 0; while(i<size){ count = 1; for (j = i+1; j < size; j++) { if (pho[j] == pho[i]) count++; else break; } if (count!=1) { left = pho[i] / 10000; if (left < 100) { cout << '0'; if (left < 10) cout << '0'; } right = pho[i] % 10000; cout << left << '-'; if (right < 1000) { cout << '0'; if (right < 100) cout << '0'; if (right < 10) cout << '0'; } cout << right << " " << count<< endl; flag = false; } i = j; } if (flag) { cout << "No duplicates." << endl; } return 0;}
0 0
- POJ1002
- POJ1002
- poj1002
- poj1002
- poj1002
- poj1002
- poj1002
- POJ1002
- poj1002
- POJ1002
- POJ1002
- POJ1002
- poj1002
- POJ1002
- POJ1002
- poj1002
- poj1002
- POJ1002
- ssm框架出现Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer问题
- Windows_一台电脑如何同时登陆多个msn
- 在Mac上 使用virtualbox虚拟机安装ubuntu
- 回文串划分
- SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null];
- POJ1002
- 《利用python进行数据分析》读书笔记之案例二:全美婴儿姓名
- js、input隐藏域实现 Action 拿到js 中值
- 设计模式思维导图
- Java NIO系列教程(三) Buffer
- ios学习第二天(四)对象之容器NSArray,NSSet,NSDictionary和它们的子类
- 超链接调 js 函数
- linux 系统性能分析常用命令
- window.open() 弹出窗口