标签:put algorithm click ima print des 质量 cte output
Time Limit: 2000MS | Memory Limit: 65536K | |
Total Submissions: 284182 | Accepted: 51001 |
Description
Input
Output
Sample Input
12
4873279
ITS-EASY
888-4567
3-10-10-10
888-GLOP
TUT-GLOP
967-11-11
310-GINO
F101010
888-1200
-4-8-7-3-2-7-9-
487-3279
Sample Output
310-1010 2
487-3279 4
888-4567 3
#include <stdio.h> #include <algorithm> using namespace std; int a[110000]; const int b[26] = {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, 9}; int main() { int n, x; char ch; scanf("%d", &n); for (int i = 0; i < n; i++) { x = 0; for (int j = 0; j < 7; j++) { while (1) { ch = getchar(); if ((‘0‘ <= ch && ch <= ‘9‘) || (‘A‘ <= ch && ch <= ‘Z‘)) { break; } } if (‘0‘ <= ch && ch <= ‘9‘) { x = x * 10 + ch - ‘0‘; } else { x = x * 10 + b[ch - ‘A‘]; } } a[i] = x; } sort(a, a + n); a[n] = -1; bool f = false; int t = 1; for (int i = 0; i < n; i++) { if (a[i] == a[i + 1]) { f = true; t++; } else { if (t > 1) { printf("%03d-%04d %d\n", a[i] / 10000, a[i] % 10000, t); t = 1; } } } if (!f) { printf("No duplicates. \n"); } return 0; }
标签:put algorithm click ima print des 质量 cte output
原文地址:http://www.cnblogs.com/dramstadt/p/6182191.html