poj-3094-quicksum

简介: http://poj.org/problem?id=3094 很简单 #include #include using namespace std; int main() { string a; int sum=0; while(getline(cin...

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

  

相关文章
|
9月前
|
算法
Wormholes—POJ3259
Wormholes—POJ3259
|
算法框架/工具
POJ 2262 Goldbach's Conjecture
POJ 2262 Goldbach's Conjecture
150 0
POJ 1067 取石子游戏
取石子游戏 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 40917   Accepted: 13826 Description 有两堆石子,数量任意,可以不同。
1131 0
poj 3620
题意:给出一个矩阵,其中有些格子干燥、有些潮湿。       如果一个潮湿的格子的相邻的四个方向有格子也是潮湿的,那么它们就可以构成更大       的湖泊,求最大的湖泊。       也就是求出最大的连在一块儿的潮湿的格子的数目。
584 0
poj 1455
Description n participants of > sit around the table. Each minute one pair of neighbors can change their places.
626 0
|
人工智能
POJ 1936 All in All
Description You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way.
802 0
|
机器学习/深度学习 算法
|
机器学习/深度学习