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 |
请教一下为什么WA?#include <stdio.h> #include <iostream> #include <math.h> #include <string> #include <memory.h> using namespace std; string _search[25100]; double stat[25100]; double sum; string unify(string matter) { int len; string change; change = ""; if(matter == "----------") return matter; for(len = 0; len < matter.size(); len++) { if( (matter[len] >= 'a' && matter[len] <= 'z' ) || ( matter[len] >= '0' && matter[len] <= '9' ) ) change += matter[len]; else if(matter[len] >= 'A' && matter[len] <= 'Z') change += char(int(matter[len]) + 32); } return change; } int main() { int i = 0,count; memset( stat, 0, sizeof(stat)); string now,change; do { cin >> now; now = unify(now); if(now != "----------") _search[i++] = now; else break; } while (true); count = i ; do { cin >> now; if( now == "----------") return 0; do { change = ""; change = unify(now); for(i = 0; i < count; i++) if(change == _search[i]) { stat[i]++; break; } cin >> now; } while (now != "----------"); sum = 0; for(i = 0; i <count; i++) { if(stat[i] != 0) sum += sqrt(stat[i]); } printf("%.2lf\n",sum); memset( stat, 0, sizeof(stat)); } while (true); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator