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
 #include<cstdio>
#include<iostream>
using namespace std;
char data[][] = {"zero", "one", "two", "three","four", "five", "six", "seven", "eight", "nine"};
int main(){
char num[];
int sum = , list[];
scanf("%s", num);
for(int i = ; num[i] != '\0'; i++)
sum += (num[i] - '');
int a, i = ;
do{
a = sum % ;
sum = sum / ;
list[i++] = a;
}while(sum != );
i--;
printf("%s", data[list[i--]]);
while(i >= ){
printf(" %s", data[list[i]]);
i--;
}
cin >> a;
return ;
}

A1005. Spell It Right的更多相关文章

  1. PAT A1005 Spell It Right (20)

    书中AC代码 #include <cstdio> #include <cstring> #include <iostream> char num[10][10] = ...

  2. PAT甲级——A1005 Spell It Right

    题目描述 Given a non-negative integer N, your task is to compute the sum of all the digits of N, and out ...

  3. PTA A1005&A1006

    第三天 A1005 Spell It Right (20 分) 题目内容 Given a non-negative integer N, your task is to compute the sum ...

  4. PAT/字符串处理习题集(二)

    B1024. 科学计数法 (20) Description: 科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[0-9]+E[+ ...

  5. PAT题目AC汇总(待补全)

    题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...

  6. PAT甲级题解分类byZlc

    专题一  字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...

  7. 1005 Spell It Right (20 分)

    1005 Spell It Right (20 分) Given a non-negative integer N, your task is to compute the sum of all th ...

  8. Spell checker

     Spell checker Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Subm ...

  9. [solr] - spell check

    solr提供了一个spell check,又叫suggestions,可以用于查询输入的自动完成功能auto-complete. 参考文献: https://cwiki.apache.org/conf ...

随机推荐

  1. Indidual Homework Assignment

    一.Pair work的得与失 合作编程在以前的学习过程中也进行过,基本也就是各人负责一部分最后再将之拼凑起来,而这次作业要求的双人合作,要求的并不是这样,而是两人应该在一起进行工作,这样的要求理想情 ...

  2. WEEK 7:团队项目的感想

    经过了几个星期的团队协作,我们的“爬虫”有了很大的完善,我作为团队中的主DEV,在这个过程中一边工作一边阅读,也有了不少的收获. Brooks的<没有银弹>告诉我们,在软件领域,没有什么绝 ...

  3. Android Studio中的Gradle是干什么的

    作者:ghui链接:https://www.zhihu.com/question/30432152/answer/48239946来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...

  4. centos7编译安装zabbix(附带编译安装lnmp)

    先把防火墙和selinux关闭: sytemctl stop firewalld setenforce 0 1.yum安装依赖: yum -y install wget openssl* gcc gc ...

  5. PHP MySql增删改查

    mysql_connect()连接数据库 mysql_select_db选择数据库 mysql_fetch_assoc()获取结果集 mysql_query()执行sql语句 实例如下: <?p ...

  6. node的router路由。

    使用router可以实现一个小型的express. router继承了大部分的app = express()的方法. 使用router可以工程化管理项目.router使用以后app只能在最开始去存在. ...

  7. ESXi安装时遇到不识别的硬件的处理

    1. 部门新购置了一台inspur 四路 NF8480M4的服务器. 上架之后发现ESXi的标准安装盘无法安装. 找不到磁盘安装介质. 2. 处理办法, 找浪潮专家服务,报上序列号,要上相关的一些软件 ...

  8. python有序字典

    最近的django开发中用到了有序字典,所以研究了一下,以下. 示例: 有序字典和通常字典类似,只是它可以记录元素插入其中的顺序,而一般字典是会以任意的顺序迭代的. 普通字典: d1={} d1['a ...

  9. python常用命令和基础运算符

    基础运算符 http://www.cnblogs.com/alex3714/articles/5465198.html 身份运算符:is is not成员运算符:in not in ##in 判断元素 ...

  10. Java微信二次开发(六)

    Token定时获取 需要导入库:添加log4j(slf4j-api-1.5.10.jar,slf4j-log4j12-1.5.10.jar,log4j-1.2.15.jar,并且在src下添加log4 ...