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

谁能帮我看一下,怎么老是wrong anwser啊

Posted by clean at 2005-04-22 14:12:14
#include<iostream>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
	int max,j,score=0;
	long int i=0;
	char a[20];
	while(cin>>a)
	{
		max=0;
		if(a[0]=='.')break;
		if(i>40000)exit(0);
		for(j=0;j<20;j++)
		{
			if(a[j]=='e'||a[j]=='s'||a[j]=='i')
				max=max+1;
			if(a[j]=='a'||a[j]=='r'||a[j]=='t'||a[j]=='n')
				max=max+2;
			if(a[j]=='l'||a[j]=='o')
				max=max+3;
			if(a[j]=='c'||a[j]=='d'||a[j]=='u')
				max=max+4;
			if(a[j]=='b'||a[j]=='g'||a[j]=='h'||a[j]=='m'||
				a[j]=='p'||a[j]=='y')
				max=max+5;
			if(a[j]=='w'||a[j]=='f'||a[j]=='v'||a[j]=='k')
				max=max+6;
			if(a[j]=='q'||a[j]=='z'||a[j]=='x'||a[j]=='j')
				max=max+7;
			if(score<max)score=max;
		}
		i++;
	}
	cout<<score;
	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