首页 > 其他 > 详细

1006. 换个格式输出整数

时间:2014-09-01 20:54:43      阅读:227      评论:0      收藏:0      [点我收藏+]
 1 /*
 2  * Main.c
 3  * 1006. 换个格式输出整数
 4  *  Created on: 2014年8月28日
 5  *      Author: Boomkeeper
 6  ***********测试通过*********
 7  */
 8 
 9 #include <stdio.h>
10 
11 int main(void){
12 
13     int temp[4]={0,0,0,0};//存放整数的各位数
14     int in;
15     int i,j;
16 
17     scanf("%3d",&in);
18 
19     j=0;
20     while(in!=0){
21         temp[j]=in%10;
22         j++;
23         in/=10;
24     }
25 
26     for(i=0;i<temp[2];i++)
27         printf("B");
28     for(i=0;i<temp[1];i++)
29         printf("S");
30     for(i=0;i<temp[0];i++)
31         printf("%i",i+1);
32     printf("\n");
33 
34     return 0;
35 }

 

题目链接:

http://pat.zju.edu.cn/contests/pat-b-practise/1006

 

1006. 换个格式输出整数

原文:http://www.cnblogs.com/boomkeeper/p/1006b.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!