April Fools Day Contest 2016 F. Ace It!

时间:2024-11-25 12:06:31

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