http://acm.hdu.edu.cn/showproblem.php?pid=2734

按规则计算就行,很简单、、、

View Code
#include <stdio.h>
#include <string.h>
int main()
{
    char s[1100];
    char tab[30]={' ','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
    int len,ans;
    int i,j;
    while(gets(s))
    {
        if(s[0]=='#')break;
        len=strlen(s);
        ans=0;
        for(i=0;i<len;i++)
            for(j=0;j<27;j++)
                if(s[i]==tab[j])
                    ans+=(i+1)*j;
        printf("%d\n",ans);
    }
    return 0;
}