杭电 2051 Bitset

http://acm.hdu.edu.cn/showproblem.php?pid=2051

#include<stdio.h>
int main(){
	int n,a[30],i,j;
	while(scanf("%d",&n) == 1){
		i = 0;
		while(n){
			a[i++] = n%2;
			n = n/2;
		}
		for(j = i-1;j >= 0;j--){
			printf("%d",a[j]);
		}
		printf("\n");			
	}
	return 0;
}


猜你喜欢

转载自blog.csdn.net/u012102588/article/details/18922491