| ||||||||||
| 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 | |||||||||
为什么会Output Limit Exceededk,改了好几次还是这样。求各位帮忙看一下。(附代码)#include "stdio.h"
#include "string.h"
#include "ctype.h"
char s[1000];
int main(){
int i,k=1,n,x=0;
long sum=0;
fgets(s,1000,stdin);
while(s[0]!='#' || s[1]!='\0'){
sum=0;
k=1;
n=strlen(s);
for(i=0;i<n;i++){
if(isalpha(s[i]))
sum=sum+k*((int)(s[i]-'A')+1);
k++;
}
printf("%ld\n",sum);
fgets(s,1000,stdin);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator