UVA 755 487-3279
2012-09-01 21:20
302 查看
这写的跑得真慢,不过还是过了。。
#include <iostream> #include <sstream> #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <vector> #include <set> #include <cctype> #include <algorithm> #include <cmath> #include <deque> #include <map> using namespace std; /// #define INF 0xffffff7 #define MAXN 200 /// int nCases; char num[] = "22233344455566677778889999"; map<string, int> tel; int main() { /// int i, j; cin >> nCases; while (nCases--) { tel.clear(); int nums; cin >> nums; for (i = 0; i < nums; i++) { string temp, trans; cin >> temp; trans = ""; int k = 0; for (j = 0; j < temp.size(); j++) { if (k == 3) { trans += '-'; k++; j--; continue; } if (isupper(temp[j])) { char ch = num[temp[j] - 'A']; trans += ch; k++; continue; } if (temp[j] == '-') continue; trans += temp[j]; k++; } tel[trans]++; } bool flag = true; map<string, int>::iterator it = tel.begin(); while (it != tel.end()) { if (it->second >= 2) { cout << it ->first << " " << it -> second << endl; flag = false; } it++; } if (flag) cout << "No duplicates." << endl; if (nCases != 0) cout << endl; } /// return 0; }
相关文章推荐
- UVa755 487-3279
- UVa 755 - 487--3279
- uva 755 487--3279(检索+排序)
- UVa 755 487--3279
- uva 755 - 487--3279
- UVa 755 / POJ 1002 - 487-3279
- UVa 755 - 487--3279
- UVA 755 - 487--3279
- uva 755 487--3279
- UVa 755 487-3279
- POJ 1002 UVA 755 487--3279 电话排序 简单但不容易的水题
- Uva 755 - 487--3279
- uva 755 487--3279
- UVA - 755 487--3279 sort的使用
- uva 755 487--3279(字母与数字处理)
- UVA 755 - 487--3279
- UVa 755 487-3279
- UVa 755 - 487--3279
- Uva-755-487--3279
- UVa 755 / POJ 1002 / East Central North America 1999 487--3279 (排序)