#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iterator>
#include <algorithm>
#define MID(x,y) ( ( x + y ) >> 1 )
#define L(x) ( x << 1 )
#define R(x) ( x << 1 | 1 )
#define BUG puts("here!!!");
#define STOP system("pause");
using namespace std;
int calc(char *str, int len) {
int sum = 0;
for(int i = 0; i < len; i++) {
if(str[i] == ' ') continue;
sum += (i + 1) * (str[i] - 'A' + 1);
}
return sum;
}
int main() {
char s[1005];
while(1) {
gets(s);
if(s[0] == '#') break;
int len = strlen(s);
cout << calc(s, len) << endl;
}
return 0;
}
poj 3094 [ 简单计算]
最新推荐文章于 2019-03-18 20:08:06 发布