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 |
换掉了cin,cout,过了。。。#include <iostream> #include <cstdio> #include <map> #include <string> #include <vector> #include <cctype> #define MAX_SIZE 10000000 using namespace std; int htable[MAX_SIZE]; int main(int argc , char **argv) { int n; char line[128]; scanf("%d" , &n); while(n--) { scanf("%s" , line); int sum = 0; for(int i = 0 ; line[i] ; ++i) { if(line[i] == '-') continue; if(isdigit(line[i])) { sum = sum * 10 + line[i] - '0'; } else { sum = sum * 10 + (line[i] - 'A' - (line[i] > 'Q')) / 3 + 2; } } ++htable[sum]; } bool is_duplicated = false; for(int i = 0 ; i < MAX_SIZE; ++i) { if(htable[i] > 1) { is_duplicated = true; printf("%03d-%04d" , i/10000 , i%10000); printf(" %d\n" , htable[i]); } } if(!is_duplicated) printf("No duplicates.\n"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator