http://poj.org/problem?id=3094
很简单
#include<cstdio> #include<iostream> using namespace std; int main() { string a; int sum=0; while(getline(cin,a)) { sum=0; if(a[0]=='#'){break;} else { for(int j=0;j<a.length();j++) {if(a[j]==' ')a[j]=64; sum+=(a[j]-64)*(j+1);} } cout<<sum<<endl; } return 0; }