HDUOJ Quicksum
#include<iostream> #include<stdlib.h> using namespace std; int main() { while (1) { int count=0; int sum=0; while (1) { char c; int temp = 0; c = getchar(); if (c == '#') return 0; if (c == '\n') break; count++; if(c!=' ') temp = count*(c-'A'+1); sum += temp; } cout << sum << endl; } }