除了这道题真的很水,我好像也不能说别的什么了吧。。。哈哈哈,注意一下控制一下循环的细节就好,一个连乘的累加
#include <stdio.h>
#include <string.h>
int main()
{
char str[300];
int sum,pos;
while(gets(str))
{
if(str[0]=='#')
break;
//计算quicksum值
pos=0;
sum=0;
while(str[pos]!='\0')
{
if(str[pos]==' ')
pos++;
else
{
sum+=(pos+1)*(str[pos]-'A'+1);
pos++;
}
}
printf("%d\n",sum);
}
return 0;
}