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. 生活沉思录 via 哲理小故事(一)

    1.小托蒂的悲剧 意大利小男孩托蒂,有一只十分奇怪的眼睛,因为从生理上看,这是一只完全正常的眼睛,但却是失明的. 原来,托蒂刚出生时,这只眼睛轻度感染,曾用绷带缠了两个星期.这对常人来说几乎没有人任何 ...

  2. kvm虚拟化管理平台WebVirtMgr部署-完整记录(3)

    继下面三篇文章完成了kvm虚拟化管理平台webvirtmgr环境的部署安装:kvm虚拟化管理平台WebVirtMgr部署-虚拟化环境安装-完整记录(0)kvm虚拟化管理平台WebVirtMgr部署-完 ...

  3. 705 B. Spider Man

    传送门 [http://codeforces.com/contest/705/problem/B] 题意 这题意看原文的真tm难懂Woc,但结合样例就知道大概意思了 两个轮流分环,可以这么理解两个人轮 ...

  4. /var/lib/mysql 的访问权限问题 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    mysql 登录不进去 提示Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) she ...

  5. 微信小程序动态数据跑马灯组件编写

    开发必备:熟悉微信小程序组件开发 开发思路:如果只有一条数据,直接用css3关键帧动画:如果有多条数据,则在当前动画运动到一定时间的时候,将其数据替换掉,使之在视觉效果上有一个从下到上播放的状态.数组 ...

  6. PAT 1026 程序运行时间

    https://pintia.cn/problem-sets/994805260223102976/problems/994805295203598336 要获得一个C语言程序的运行时间,常用的方法是 ...

  7. PAT 1011 A+B和C

    https://pintia.cn/problem-sets/994805260223102976/problems/994805312417021952 给定区间[-2^31^, 2^31^]内的3 ...

  8. Using svn in CLI with Batch

    del %~n0.txt@echo offsetlocal EnableDelayedExpansionfor /f "delims=" %%i in ('DIR /A:D /B' ...

  9. HTTP消息头(HTTP headers)-常用的HTTP请求头与响应头

    HTTP消息头是指,在超文本传输协议( Hypertext Transfer Protocol ,HTTP)的请求和响应消息中,协议头部分的那些组件.HTTP消息头用来准确描述正在获取的资源.服务器或 ...

  10. jest & puppeteer & 单元测试 & 集成测试

    jest & puppeteer 单元测试 & 集成测试 单元测试,就是测试一个函数或某个代码片段,通过模拟输入确保输出符合预期 集成测试,测的是一个功能模块,比如用户注册功能,集成测 ...