当前位置:编程学习 > C/C++ >>

HDU 2051 Bitset

Bitset
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9931 Accepted Submission(s): 7686

 


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

 


 

 

import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(new BufferedInputStream(System.in));
		while(sc.hasNext()){
			int m=sc.nextInt();
			String s=Integer.toBinaryString(m);
			System.out.println(s);
		}
	}

}

 

补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,