1005. Spell It Right (20)[C语言]
来源:互联网 发布:服装erp软件 编辑:程序博客网 时间:2024/06/06 01:09
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 <stdio.h>#include <stdlib.h>const char a[10][9] = {"zero","one","two","three","four","five","six","seven","eight","nine"} ;void print( long long sum ){if(sum / 10 !=0){int r = sum%10 ;print((sum-r) /10);printf( " %s",a[r] );}else{printf( "%s", a[sum] );}}int main(){long long sum = 0 ;char c ;scanf("%c" ,&c);while(c!='\n'){ sum=sum+((int)c)-48; scanf("%c" ,&c);} print(sum); return 0 ;}
0 0
- 1005. Spell It Right (20)[C语言]
- PAT Advanced 1005. Spell It Right (20) (C语言实现)
- 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)
- spring中ApplicationListener源码分析
- LeetCode刷题(C++)——Merge Two Sorted Lists(Easy)
- 关于HBuilder在云端打包和本地手机运行效果不同的问题
- 《EAGRE: Towards scalable I/O efficient SPARQL query evaluation on the cloud》——论文笔记
- android C++和Java通过JNI机制相互调用
- 1005. Spell It Right (20)[C语言]
- bzoj 2751: [HAOI2012]容易题(easy) 数学
- Python 3基础教程25-异常处理
- 记一次Redis设置主从复制时遇到的问题
- [leetcode]557. Reverse Words in a String III
- 用友 uap nc65开发中的查询模版源代码讲解
- Leetcode-Two Sum
- Python Notes (7)
- 1006. Sign In and Sign Out (25)[C语言]