杭电2734

 1 #include<stdio.h>
 2 
 3 char s[300];
 4 
 5 int lenth(char s[])
 6 {
 7     int i=0;
 8     while(s[i]!='')
 9         ++i;
10     return i;
11 }
12 int main()
13 {
14     int n,i,ans,len;
15     while(gets(s)&&s[0]!='#')
16     {
17         len=lenth(s);
18         for(i=ans=0; i<len; ++i)
19         {
20             if(s[i]!=' ')
21                 ans+=(i+1)*(s[i]-'A'+1);
22         }
23         printf("%d
",ans);
24     }
25 }
原文地址:https://www.cnblogs.com/qq188380780/p/6219603.html