PAT a1005题解
来源:互联网 发布:无人机地面站软件 编辑:程序博客网 时间:2024/06/05 08:37
#include <cstdio>#include <cstring>char* change(int n){switch(n){case 0: return "zero"; break;case 1: return "one"; break;case 2: return "two"; break;case 3: return "three"; break;case 4: return "four"; break;case 5: return "five"; break;case 6: return "six"; break;case 7: return "seven"; break;case 8: return "eight"; break;case 9: return "nine"; break;}}int main(){int sum = 0;char a[105];scanf("%s", a);int len = strlen(a);for(int i = 0; i < len; i++){sum = sum + a[i] - '0';}int bai, shi, ge;bai = sum / 100;shi = sum / 10 % 10;ge = sum % 10;if(bai != 0){printf("%s %s %s", change(bai), change(shi), change(ge));}else{if(shi != 0){printf("%s %s", change(shi), change(ge));}else{printf("%s", change(ge));}}return 0;}
阅读全文
1 0
- PAT a1005题解
- PAT A1005
- PAT-A1005
- 浙大 PAT a1005
- pat a1005(暂缺)
- PAT A1005 Spell It Right
- PAT A1005. Spell It Right
- 【PAT】 A1005. Spell It Right (20)
- PAT---A1005. Spell It Right (20)
- PAT A1005. Spell It Right (20)
- PAT:A1005. Spell It Right (20/20)
- PAT A1005 Spell It Right(20)
- PAT-A1005. Spell It Right (20)(模拟)
- PAT 1001-1010 题解
- PAT 1011-1020 题解
- PAT 1021-1030 题解
- PAT 1031-1040 题解
- PAT 1041-1050 题解
- Hadoop完全分布式在实际中优化方案
- 如何定义一个只能在堆上(栈上)生成对象的类?
- 前端如何实现图片懒加载(lazyload) 提高用户体验
- Java经典算法40例(二十九)
- Stall Reservations
- PAT a1005题解
- 如何定义一个只能在栈/堆上生成对象的类
- 通过URL实现下载
- java基础之数字处理类
- md5 加密工具类
- Prime Ring Problem
- python 简单图像处理(13) 二值图腐蚀和膨胀,开运算、闭运算
- JSP学习笔记(4)_HTTP协议
- 最小表示法, 求字典序最小