您的位置:首页 > 其它

April Fools Day Contest 2016 F. Ace It!

2016-04-02 20:01 501 查看

F. Ace It!

题目连接:

http://www.codeforces.com/contest/656/problem/F

Description

Input

The only line of the input is a string of 7 characters. The first character is letter A, followed by 6 digits. The input is guaranteed to be valid (for certain definition of "valid").

Output

Output a single integer.

Sample Input

A221033

Sample Output

21

Hint

题意

给你一个字符串,然后输出答案

题解:

仔细观察,大胆猜测,就是数位数字之和,A是1,1是10

然后不要oeis hhh

代码

#include<bits/stdc++.h>
using namespace std;

string s;
int main()
{
cin>>s;
int res = 0;
for(int i=0;i<s.size();i++)
{
if(s[i]>='2'&&s[i]<='9')
res+=(int)(s[i]-'0');
else if(s[i]=='1')res+=10;
}
cout<<res+1<<endl;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: