1006. 换个格式输出整数 (15)
来源:互联网 发布:同花顺龙虎榜数据 编辑:程序博客网 时间:2024/05/16 08:55
题目:http://www.patest.cn/contests/pat-b-practise/1006
代码:
#include <stdio.h>#include <math.h>int main(){ int n; int weishu=1,i,j; scanf("%d",&n); while ( n/(int)pow(10.0,weishu) ) weishu++; if (weishu == 1) { for (i=1;i<=n;i++) printf("%d",i); } else if (weishu == 2) { j = n/10; for (i=1;i<=j;i++) printf("S"); j = n%10; for (i=1;i<=j;i++) printf("%d",i); } else { j = n/100; for (i=1;i<=j;i++) printf("B"); j = (n/10)%10; for (i=1;i<=j;i++) printf("S"); j = n%10; for(i=1;i<=j;i++) printf("%d",i); } return 0;}
0 0
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- 1006. 换个格式输出整数 (15)
- [剑指offer-1386]旋转数组的最小数字
- Codeforces Round #340 (Div. 2) E. XOR and Favorite Number(分块 (java))
- 1004. 成绩排名 (20)
- [剑指offer-1515]打印1到最大的N位数
- 1005. 继续(3n+1)猜想 (25)
- 1006. 换个格式输出整数 (15)
- ls指令详解
- 1007. 素数对猜想 (20)
- 第一次出国 之 泰国游记,
- 【POJ1743】Musical Theme【后缀数组】【二分】
- 1008. 数组元素循环右移问题 (20)
- 1009. 说反话 (20)
- 1010. 一元多项式求导 (25)
- Linux创建目录和文件管理