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月前
|
容器
POJ 3640 Conformity
POJ 3640 Conformity
40 0
|
存储
POJ 1067 取石子游戏
取石子游戏 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 40917   Accepted: 13826 Description 有两堆石子,数量任意,可以不同。
1087 0
poj 3664
http://poj.org/problem?id=3664 进行两轮选举,第一轮选前n进入第二轮,第二轮选最高   #include #include using namespace std; struct vote { int a,b; int c; ...
706 0
|
算法 数据建模 机器学习/深度学习
poj题目分类
http://www.cnblogs.com/kuangbin/archive/2011/07/29/2120667.html
759 0