1005.Spell It Right
来源:互联网 发布:武汉mac口红专柜在哪里 编辑:程序博客网 时间:2024/05/17 07:16
【题意】
把给的数字每一位加起来,然后用英文表示结果的每一位
【思路】
按题意直接算即可
#include <iostream>#include <string>using namespace std;string number[10]={"zero","one","two","three","four","five","six","seven","eight","nine"};void spell(int num){if(num/10>0){spell(num/10);cout << " ";}cout << number[num%10];}int main(){string str;int sum=0;cin >> str;for(int i=0; i<str.length(); i++){sum = sum+str[i]-'0';}spell(sum);system("pause");return 0;}
0 0
- 1005. Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right
- 1005.Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- pat 1005. Spell It Right
- liferay6.2 获取entity对象的主键值报错:Data too long for column 'name' at row 1
- 设计模式之简单工厂模式
- Material Design设计规范
- 程序员总结:帮助你早些明白一些道理
- 分布式缓存-Memcached
- 1005.Spell It Right
- Oracle10g数据库备份与恢复总结1--Oracle备份与恢复之概述
- Unity学习一之(初学脚本 MonoBehaviour类 )
- #undef 标识符
- 中国互联网量级分化严重:小米将360踢出第二阵营
- 斜率优化DP BZOJ 1010
- Java内存区域
- 2014年博客之星评选,请大家多多支持
- Java web过滤器验证登录(避免未经登录进入主页)