| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
……似乎代码都很长
贴一段AC的短代码……调了半天结果忘记输出No......
#include <cstdio>
#define ll 10000
#define maxn 10000000
using namespace std;
const int w[27] = {0, 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 t[maxn + 5] = {0};
int n, p, k, i, tt;
char c;
int Deal(char c)
{
int t = 0;
if (c >= 65 && c <= 90) t = 1, k = k * 10 + w[c - 64];
if (c >= 48 && c <= 57) t = 1, k = k * 10 + c - '0';
return t;
}
int main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
for (scanf("%d", &n); n--; )
{
p = 7; k = 0;
while (p) c = getchar(), p -= Deal(c);
while (c != '\n') if (c = getchar()) break;
t[k]++;
}
for (i = 0; i < maxn; ++i)
if (t[i] > 1) printf("%03d-%04d %d\n", i / ll, i % ll, t[i]), tt = 1;
if (!tt) printf("No duplicates.");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator