hdu2051 Bitset(C语言)
2017-07-28 11:13
281 查看
Problem Description
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
Author
8600 && xhd
Source
校庆杯Warm Up
C语言AC代码
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
Author
8600 && xhd
Source
校庆杯Warm Up
C语言AC代码
#include<stdio.h> int main() { int i,n,t,a[10000]; while(scanf("%d",&n)!=EOF) { for(i=0;n>0;i++) { a[i]=n%2; n=n/2 4000 ; t=i; } for(i=t;i>=0;i--) printf("%d",a[i]); printf("\n"); } return 0; }
相关文章推荐
- HDU2051 Bitset
- Bitset[HDU2051]
- hdu2051 Bitset (十进制转化为二进制) java
- HDU2051 Bitset
- HDU2051 Bitset
- hdu2051 bitset
- hdu2051 Bitset
- C语言 - 位运算 - bitset
- Hdu2051 *** Bitset (十进制化二进制)
- HDU2051 Bitset
- HDU2051_Bitset
- HDU2051 Bitset
- C语言指针实例详解double *(*a)[3][6]
- 黑马程序员---【C语言】01漫谈C与C++
- C语言之enum,sizeof,typedef分析
- C语言中,数字后面带个U,L,F的含义
- C语言goto 语句
- C语言中递归什么时候能够省略return引发的思考:通过内联汇编解读C语言函数return的本质
- C语言博客作业--函数
- C语言开发病毒程序(转)