HDOJ2051_Bitset
2017-10-09 23:01
405 查看
[align=left]Problem Description[/align]
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
[align=left]Input[/align]
For each case there is a postive number n on base ten, end of file.
[align=left]Output[/align]
For each case output a number on base two.
[align=left]Sample Input[/align]
1
2
3
[align=left]Sample Output[/align]
1
10
11
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
[align=left]Input[/align]
For each case there is a postive number n on base ten, end of file.
[align=left]Output[/align]
For each case output a number on base two.
[align=left]Sample Input[/align]
1
2
3
[align=left]Sample Output[/align]
1
10
11
import java.util.Scanner; /** * 位集合 * 题目的意思也就是将一个十进制的数转换为二进制然后输出 * @author 逸川同学 * */ public class P2051 { private static Scanner scanner; public static void main(String[] args) { scanner = new Scanner(System.in); while(scanner.hasNext()){ int n = scanner.nextInt(); String string = ""; while(n>0){ string = n%2+string; n = n/2; } System.out.println(string); } } }
相关文章推荐
- hdoj 2051 Bitset【10进制转2进制】
- hdoj 2051 Bitset (进制转换)
- hdoj-2051-Bitset
- Bitset hdoj 2051
- hdoj.2051 Bitset 20140729
- hdoj 2051 Bitset
- HDOJ 2051 Bitset
- hdoj-2051-Bitset
- Hdoj 2051 Bitset
- HDOJ 2051 Bitset
- Hdoj 2051 Bitset
- HDOJ 2051 Bitset
- HDOJ-- 2051 Bitset
- Bitset hdoj 2051
- hdoj 2051 Bitset(数的进制转换问题)
- HDU-2051-Bitset(十进制转换为2进制)
- HDOJ--2051
- HDU 2051 Bitset
- HDU——2051——Bitset
- 杭电2051 Bitset