码迷,mamicode.com
首页 > 其他好文 > 详细

HDUOJ Quicksum

时间:2018-09-08 00:45:10      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:getch   cout   std   ret   stream   tchar   str   while   hduoj   

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

 

HDUOJ Quicksum

标签:getch   cout   std   ret   stream   tchar   str   while   hduoj   

原文地址:https://www.cnblogs.com/DaiShuSs/p/9607567.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!