Y
来源:互联网 发布:淘宝买啥弓箭好 编辑:程序博客网 时间:2024/04/18 04:50
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
Input
For each case there is a postive number n on base ten, end of file.
Output
For each case output a number on base two.
Sample Input
1
2
3
Sample Output
1
10
11
#include<stdio.h>#define maxn 100000int main(){ int x; int a[maxn]; int count,i,n; while(scanf("%d",&x)==1) { for(i=0; ; i++) { n=0; n=x % 2; a[i] = n; x = (x-n)/2; count = i; if (x<1) break; } for(i=count; i>=0; i--) printf("%d",a[i]); printf("\n"); } return 0; }
阅读全文
0 0
- y
- y
- Y
- Y
- Y
- Y
- y
- Y
- Y
- y
- Y
- Y
- Y
- Y
- Y
- Y
- Y
- Y-Combinator
- 判断拐弯
- 【SSLGZ 2811】2017年10月30日提高组T2 摘Galo
- TSP问题及蚁群算法理解与实现
- 代理模式
- 用SQL profiler工具抓指定表名的动态
- Y
- [Tensor] tf.nn.conv2d函数中的padding参数
- java通过反射实现HttpServlet
- intellij idea编辑器里面的字母有的隐形了是为什么
- 超级楼梯(斐波那契数列应用)
- Ubuntu下使用root账号登录
- maya(学习笔记)之骨骼中关节的轴向确定方法
- Springmvc+Spring+Hibernate中@Valid的使用
- 【java学习】修饰符