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;
} 

 

相关文章:

  • 2021-06-18
  • 2021-12-30
  • 2021-12-19
  • 2021-08-28
  • 2022-12-23
  • 2021-08-08
  • 2021-09-18
猜你喜欢
  • 2021-09-21
  • 2022-01-04
  • 2021-08-16
  • 2021-10-28
  • 2021-08-12
相关资源
相似解决方案