一种特殊的字符加法,主要考察字符应用,水题
题目大意:一种特殊的字符加法,按照题目所属即可
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <cmath>
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
while(1)
{
int total = 0;
char s[1005];
gets(s);
if(s[0]=='#') break;
for(int i=0;i<strlen(s);i++)
{
if(s[i]>='A'&&s[i]<='Z')
{
total += (i+1) * ( s[i]-'A' + 1 );
}
}
printf("%d\n",total);
}
//system("pause");
return 0;
}