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 "map" #include "iostream" #include "algorithm" #include "cstring" #include "string" #define N 100 using namespace std; map<string,int> set; map<string,int>::iterator iter; int main() { char c,now[N]; int i=0,a=0,b=0,m; while((c=getchar())!=EOF){ if(c>='a'&&c<='z'||c>='A'&&c<='Z') now[i++]=c; else if(i>0){ now[i]='\0'; if(strcmp(now,"BULLSHIT")==0){ b++;a+=set.size(); set.clear(); } else set[now]++; i=0; } } m=a>b?b:a; for(i=m;i>1;i--) if(a%i==0&&b%i==0){ a/=i;b/=i; break; } printf("%d / %d\n",a,b); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator