Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

跪求大牛帮看码……WA到疯了

Posted by flyfire2003 at 2008-06-12 13:41:30 on Problem 2471 and last updated at 2008-06-12 13:41:52
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator