| ||||||||||
| 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 | |||||||||
Re:提交后怎么结果总是错?In Reply To:提交后怎么结果总是错? Posted by:2_040430224 at 2005-12-28 15:52:16 > 我在我的机子上运行的结果一点都没错啊.郁闷死了!
> 不知道是怎么会事.大家谁有经验,给指点一二!感激不尽!
#include "iostream.h"
#include "string.h"
void main( )
{
char string[40000][8];
int i=-1;
int temp;
do{
i++;
cin>>string[i];
}while(string[i][0]!='.');
int *iptr=new int[i];
for(int j=0;j<i;j++)
{
iptr[j]=0;
}
for(int count=0;count<i;count++)
{
for(int k=0;k<(int)strlen(string[count]);k++)
{
switch(string[count][k]){
case 'a':
case 'r':
case 't':
case 'n':
iptr[count]=iptr[count]+2;
break;
case 'b':
case 'm':
case 'g':
case 'h':
case 'y':
case 'p':
iptr[count]=iptr[count]+5;
break;
case 'c':
case 'd':
case 'u':
iptr[count]=iptr[count]+4;
break;
case 'e':
case 'i':
case 's':
iptr[count]=iptr[count]+1;
break;
case 'f':
case 'k':
case 'v':
case 'w':
iptr[count]=iptr[count]+6;
break;
case 'j':
case 'z':
case 'x':
case 'q':
iptr[count]=iptr[count]+7;
break;
case 'l':
case 'o':
iptr[count]=iptr[count]+3;
break;
}
}
}
int max=iptr[0];
for(count=1;count<i;count++)
{
if(max<iptr[count])
{
temp=max;
max=iptr[count];
iptr[count]=temp;
}
}
cout<<max<<endl;
delete []iptr;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator