#include <stdio.h> #include <string.h> char word[301]; int main() { int sum = 0; int i,len; while(gets(word)) { sum = 0; if(word[0] == ‘#‘) break; len = strlen(word); for(i = 0; i < len; ++i) { if(word[i] != ‘ ‘) sum += (i+1) * (word[i]-‘A‘+1); } printf("%d\n",sum); } return 0; }
时间: 2024-10-29 19:08:24