国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

PAT A1005. Spell It Right (20)

2019-11-11 01:29:50
字體:
來源:轉載
供稿:網友

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 <cstdio>#include <algorithm>#include <cmath>#include <cstring>#define Max 100001using namespace std;int main(){	char N[11][11]={"zero","one","two","three","four","five","six","seven","eight","nine"};	char n[111];	int sum=0,m[111],k=0;	scanf("%s",n);	for(int i=0;i<strlen(n);i++)	{		sum+=n[i]-'0';	}	if(sum==0) PRintf("zero/n");	else {		while(sum>0)		{			m[k++]=sum%10;			sum/=10;		}		for(int i=k-1;i>=0;i--)		{			printf("%s",N[m[i]]);			if(i==0) printf("/n");			else printf(" ");		}	}	system("pause");	return 0;}
上一篇:HashTable

下一篇:歸并排序算法

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 栖霞市| 灵石县| 福贡县| 平果县| 正镶白旗| 仁寿县| 岐山县| 周口市| 南开区| 阳春市| 饶阳县| 榆树市| 乌兰察布市| 乐亭县| 汶上县| 济源市| 河曲县| 闻喜县| 台南县| 阿坝| 项城市| 新田县| 左云县| 乌什县| 湖州市| 谢通门县| 普陀区| 西峡县| 韶关市| 塔城市| 五家渠市| 禄丰县| 屯昌县| 花莲市| 沙坪坝区| 和静县| 泸水县| 平定县| 海伦市| 竹山县| 马鞍山市|