| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:你代码太长In Reply To:Re:你代码太长 Posted by:cz_insane at 2013-02-15 17:26:33 > #include <iostream>
> #include <string.h>
> #include <string>
> using namespace std;
>
> int i,n;
> long long ans;
> string str;
>
> int main(){
> while (getline(cin,str)&&(str!="#")) {
> ans = 0;
> n = str.length();
> for (i = 0; i < n; i++) {
> ans += (i + 1) * (str[i] == ' ' ? 0 : str[i] - 64);
> }
> cout<<ans<<endl;
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator