HDOJ 2051 Bitset
2016-01-27 15:37
316 查看
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
就是将一个十进制的数按二进制输出。
JAVA中直接调用Integer.toBinaryString(int i);
以二进制(基数 2)无符号整数形式返回一个整数参数的字符串表示形式。
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
就是将一个十进制的数按二进制输出。
JAVA中直接调用Integer.toBinaryString(int i);
以二进制(基数 2)无符号整数形式返回一个整数参数的字符串表示形式。
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); System.out.println(Integer.toBinaryString(n)); } } }
相关文章推荐
- Speeding up Gradle builds
- git命令
- 二分法求数组中某个数出现的位置索引
- 2月组会pre
- PHP之常量
- 初步认识SVG
- 控制输入法软键盘隐藏
- ALSA声卡驱动中的DAPM详解之五:建立widget之间的连接关系
- 1-渗透测试技术基础
- 鼠标进出效果
- 51NOD 1099 任务执行顺序
- Android框架模式(1)-MVP入门
- 从零开始学Swift计时器App开发
- lock关键字只不过是C#提供的语法糖
- 模拟HTTP请求:Request Maker
- python基础:三元运算
- 标准C语言中使用bool类型
- apache mod_proxy 扩展模块安装
- 三星、微软高调推新品,平板行业“风水轮流转”?
- 设计模式之:访问者模式(Visitor)