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 == '
')
                break;
            count++;
            if(c!=' ')
                temp = count*(c-'A'+1);
            sum += temp;
        }
        cout << sum << endl;
    }
}
原文地址:https://www.cnblogs.com/DaiShuSs/p/9607567.html