PAT 1005. Spell It Right (20)
2015-03-04 21:16
489 查看
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:
12345
Sample Output:
one five
思路: .......Python大法好!
dic={"1":"one","2":"two","3":"three","4":"four","5":"five", "6":"six","7":"seven","8":"eight","9":"nine","0":"zero"} raw = input() lists = list(raw) Sum = 0 for item in lists: Sum += int(item) lists = list(str(Sum)) for item in lists[:-1]: print(dic.get(item),end=" ") print(dic.get(lists[-1]),end="")
相关文章推荐
- PAT Advanced 1005. Spell It Right (20) (C语言实现)
- pat 1005. Spell It Right (20)
- PAT甲级 1005. Spell It Right (20)
- 1005. Spell It Right (20)——PAT (Advanced Level) Practise
- PAT 1005. Spell It Right (20)
- PAT1005. Spell It Right (20)
- 【PAT甲级】【C++】1005. Spell It Right (20)
- PAT (Advanced Level) Practise 1005. Spell It Right (20)
- PAT (Advanced Level) 1005. Spell It Right (20) string转int,哈希
- PAT (Advanced Level) 1005. Spell It Right (20)
- 【PAT】1005. Spell It Right (20)
- PAT1005. Spell It Right (20)
- PAT1005. Spell It Right (20)
- PAT 甲 1005. Spell It Right (20)
- PAT:A1005. Spell It Right (20/20)
- [PAT] 1005 Spell It Right (20)
- 1005. Spell It Right (20) PAT甲级刷题
- pat 1005. Spell It Right (20)
- (PAT)1005. Spell It Right (20)
- PAT (Advanced Level) 1005. Spell It Right (20)