1005. Spell It Right (20)
来源:互联网 发布:树莓派3b gpio编程 编辑:程序博客网 时间:2024/06/03 12:00
1005. Spell It Right (20)
时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.
Input Specification:
Each input file contains one test case. Each case occupies one line which contains an N (<= 10100).
Output Specification:
For each test case, output in one line the digits of the sum in English words. There must be one space between two consecutive words, but no extra space at the end of a line.
Sample Input:12345Sample Output:
one five
题意:
给你一串数字,全部相加之后用英文输出每一位
#include <iostream>#include <sstream>using namespace std;string EngName[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};int main(){ string s; int num, i; stringstream ss; num = 0; cin >> s; for(i = 0; i < s.length(); i++){ num = num + s[i] - '0'; } ss << num; ss >> s; for(i = 0; i < s.length(); i++) if(i == 0) cout << EngName[s[i] - '0']; else cout << ' ' << EngName[s[i] - '0']; //system("pause");}
0 0
- 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)
- 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)
- 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)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- Canvas的四个常用方法
- 项目总结 iFun 个人生活 webapp
- 单例设计模式(三)-------简单实现一个单例设计模式
- OpenGL编程(一)渲染一个指定颜色的背景窗口
- IOS学习 scrollView的单张图片缩放
- 1005. Spell It Right (20)
- 51nod 1090 3个数的和为0
- Python爬取韩寒全部新浪博客
- 课堂作业3
- CodeForces - 630G Challenge Pennants (组合数学)
- SparkContext的初始化(季篇)——测量系统、ContextCleaner等组件介绍
- 定义一个一维指针指向二维数组并打印
- Android多点触控技术实战,自由地对图片进行缩放和移动
- CodeForces - 630R Game (规律)水