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;
    }
}

 

posted @ 2018-09-07 23:32  图袋鼠  阅读(83)  评论(0编辑  收藏  举报