PAT 1005 Spell It Right
来源:互联网 发布:mac high sierra好吗 编辑:程序博客网 时间:2024/04/28 10:17
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 <string.h>#include <stdlib.h>#include <stdio.h>#include <algorithm>#include <math.h>#include <queue>#include <map>#include <strstream>#include <string>using namespace std;char a[105];map<int,string> m;int main(){ m[0]="zero"; m[1]="one"; m[2]="two"; m[3]="three"; m[4]="four"; m[5]="five"; m[6]="six"; m[7]="seven"; m[8]="eight"; m[9]="nine"; scanf("%s",a); int num=0; int len=strlen(a); for(int i=0;i<len;i++) num+=(a[i]-'0'); string s; strstream ss; ss << num; ss >> s; int len2=s.length(); for(int i=0;i<len2;i++) { if(i==len2-1) cout<<m[s[i]-'0']<<endl; else cout<<m[s[i]-'0']<<" "; } return 0;}
0 0
- 【PAT】1005 Spell It Right
- PAT 1005 Spell It Right
- PAT 1005 Spell It Right
- PAT Advanced Level 1005:Spell It Right
- PAT-A | 1005 | Spell It Right
- PAT甲级 1005:Spell it Right
- [PAT] 1005 Spell It Right (20)
- pat甲级1005-Spell It Right
- pat 1005. Spell It Right
- PAT A1005 Spell It Right
- PAT 1005. Spell It Right
- PAT:1005. Spell It Right
- 【PAT】1005. Spell It Right
- PAT A1005. Spell It Right
- 1005 Spell it right
- 浙大PAT 1005题 1005. Spell It Right
- Pat(Advanced Level)Practice--1005(Spell It Right)
- PAT (Advanced Level) Practise 1005 Spell It Right (20)
- Javascript 读取浏览器名及版本号
- NYOJ-35-表达式求值
- Java 中日期格式的转化
- css3渐变、倒影、过渡 20160526
- Doctype
- PAT 1005 Spell It Right
- WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping。请添加一个名为 jquery (区分大小写)的 ScriptRes
- 利用YCSB工具对mongodb进行压测
- Fragment 实现android项目主流APP Tab (微博,今日头条等等),解决横竖屏切换重叠,以及切换回调。
- python eventlet模块
- android 学习过程问题整理(待续)
- 循环队列(Circular Queue)
- 1483 化学反应
- 欢迎使用CSDN-markdown编辑器