PAT1002 写出这个数 初学者
来源:互联网 发布:来源笔记软件 编辑:程序博客网 时间:2024/05/23 23:10
写出这个数
#include "stdafx.h"#include <stdio.h>#include<string.h>int main(){char arry[100] = { 0 };int s = 0;scanf("%s", arry); //存入的是字符int len=strlen(arry);//错误的为零 没有考虑顺序逻辑for (int i = 0; i <len; i++){s += (arry[i]-'0');}//printf("%d",s);int b[10] = {};int nCount = 0;for (int i=0;i<10;i++){if (s >=1){b[i] = s % 10;s = (s - b[i]) / 10;nCount++;}}for (int i = 0; i < nCount; i++){switch (b[nCount-i-1]){case 0:printf("ling");break;case 1:printf("yi");break;case 2:printf("er");break;case 3:printf("san");break;case 4:printf("si");break;case 5:printf("wu");break;case 6:printf("liu");break;case 7:printf("qi");break;case 8:printf("ba");break;case 9:printf("jiu");break;default:break;}if((nCount - i - 1)>0) printf(" ");} return 0;}
阅读全文
1 0
- PAT1002 写出这个数 初学者
- pat1002,写出这个数
- PAT1002 写出这个数
- PAT1002. 写出这个数
- PAT1002.写出这个数
- pat1002:写出这个数
- PAT1002写出这个数
- PAT1002. 写出这个数
- PAT1002. 写出这个数 (20)
- 从零单排PAT1002. 写出这个数
- PAT1002. 写出这个数;java实现
- PAT1002 写出这个数 int《=》string
- pat1002.写出这个数(20)
- PAT1002 写出这个数 (20) JAVA
- PAT1002. 写出这个数 (20)解题思路
- 写出这个数
- PAT-写出这个数
- 1002 写出这个数
- bzoj 2081 [Poi2010]Beads 枚举+哈希
- NBiot系统开发,测试
- [luogu2184]贪婪大陆(树状数组)
- Bigger插件v2.0.1官方版下载附安装方法
- 一站式解决java web乱码问题
- PAT1002 写出这个数 初学者
- 【转载】希尔排序
- poj2778 DNA Sequence (AC自动机+矩阵乘法)
- ADV-169 士兵排队问题
- 简单的线段树
- 用函数对象表示策略。
- android隐藏apk方式以及apk之间的启动方式
- 【网易】最长公共子括号序列
- 使用Redis SETNX 命令实现分布式锁