April Fools Day Contest 2016 F. Ace It!
2016-04-02 20:01
501 查看
F. Ace It!
题目连接:
http://www.codeforces.com/contest/656/problem/FDescription
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
A221033Sample Output
21Hint
题意
给你一个字符串,然后输出答案题解:
仔细观察,大胆猜测,就是数位数字之和,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; }
相关文章推荐
- 第十八章读书笔记
- 浅谈动态规划算法设计
- 实践--课程表(仿超级课程表展示课表)
- 集合的遍历
- Libevent源码分析(七)--- IOCP
- VideoView无法播放此视频 android问题
- js保留小数点后面几位的方法
- 15个你必须知道的Facebook开源项目
- Android SQLite调试
- 使用maven-assembly-plugin打包dubbo接口
- iOS学习笔记之TableViewCell右侧滑动多项操作
- 文本数据的机器学习自动分类方法
- L1-5. 考试座位号
- activity与fragment之间传递数据
- 如何将div中的内容设置为空同时还要保留div本身
- Eclipse下Maven工程多模块继承和聚合的创建
- 大数据工程师:大数据的java基础 第五周
- 1969年美国(阿波罗)登月真伪
- 任意进制之间的转换问题 !!!非常nb的代码哦!!
- 用c语言解决闰年问题的详细解释