美文网首页
poj3094 string模拟

poj3094 string模拟

作者: 暖昼氤氲 | 来源:发表于2019-11-29 13:08 被阅读0次
     /*
    Time:2019.11.29
    Author: Goven
    type:string模拟 
    err:
    ref:
    */
    #include<iostream>
    #include<string>
    using namespace std;
    
    int main()
    {
        string s;
        int l, quickSum;
        while (getline(cin, s) && s != "#") {
            l = s.length();
            quickSum = 0;
            for (int i = 0; i < l; i++) {
                if (s[i] == ' ') continue;
                quickSum += (s[i] - 'A' + 1) * (i + 1);
            }
            cout << quickSum << endl;
        } 
        return 0;
    }
    
    

    相关文章

      网友评论

          本文标题:poj3094 string模拟

          本文链接:https://www.haomeiwen.com/subject/vqzwwctx.html