| ||||||||||
| 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 | |||||||||
谁能帮我看一下,怎么老是wrong anwser啊#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator