poj 字符串相关之1002 487-3279
来源:互联网 发布:overlay网络的价值 编辑:程序博客网 时间:2024/06/07 00:09
poj 字符串相关之1002 487-3279
map
#include<iostream>#include<cstring>#include<string>#include<cstdio>#include<math.h>#include<algorithm>#include<vector>#include<queue>#include<map>using namespace std;int N;char res[20], str[300];char TONumber[26] = {'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', '0' }; map<string, int>mp;int main(){ freopen("1.txt", "r", stdin); int i, j, k, t; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%s", str); t = 0; for (j = 0; j < strlen(str); j++) { if (str[j] >= 'A'&&str[j] <= 'Z') res[t++] = TONumber[str[j] - 'A']; else if (str[j] >= '0'&&str[j] <= '9') res[t++] = str[j]; } for (j = 7; j >= 4; j--) res[j] = res[j - 1]; res[3] = '-'; string tmp(res, 8); if (mp[tmp]) mp[tmp]++; else mp[tmp] = 1; } k = 0; map<string, int>::iterator iter = mp.begin(); for (; iter != mp.end(); iter++) { if (iter->second > 1) { cout << iter->first << " " << iter->second << endl; k++; } } if (!k) printf("No duplicates.\n");}
阅读全文
0 0
- poj 字符串相关之1002 487-3279
- poj 字符串相关之3038
- poj 字符串相关之1200 Crazy Search
- poj 字符串相关之1204 Word Puzzles
- poj 字符串相关之1816 Wild Words
- poj 字符串相关之2513 Colored Sticks
- POJ 1002 487-3279 字符串处理
- R之字符串相关
- R之字符串相关
- JS之字符串相关
- poj 字符串相关的水题
- POJ 1002 487-3279 - 字符串转换为数组
- poj之3671 字符串排序
- poj 1002 487-3279之map解法
- POJ-1002(字符串+排序)
- poj 1002 字符串
- poj 1002 string字符串
- poj 1002 (字符串基础)
- apache,nigix,tomcat区别与优缺点
- ZOJ 1733(Common Subsequence)
- java-Math类Random方法获取随机数案例
- 如何用wordpress搭建个人博客
- android安卓java文件转kotlin格式
- poj 字符串相关之1002 487-3279
- 动脑学院听课笔记-缓存那些事20170622
- nil和NULL 的区别
- Java虚拟机运行时的数据区域
- mysql 5.6 主从复制配制
- ZOJ 1259(Rails)
- 在activity里面实现fragment管理
- 实战
- [BZOJ 4454]C Language Practice:GCD