| ||||||||||
| 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<stdio.h>
#include<string.h>
#define N 256
char a[N];
int main()
{
while(fgets(a,N,stdin)&&a[0]!='#')
{
int i,n,sum=0;
n=strlen(a);
//printf("%d ",n);
for(i=0;i<n-1;i++)
if(a[i]!=' ')
sum+=(a[i]-'A'+1)*(i+1);
printf("%d\n",sum);
}
return 0;
}
我把fgets换成gets就通过了
fgets为什么会不行呢?
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator