HDU2051Bitset
2017-12-06 00:49
127 查看
本文章仅用于笔记。部分知识点来源于网络,授权请联系作者(947043511@qq.com)。
题目
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
InputFor each case there is a postive number n on base ten, end of file.
OutputFor each case output a number on base two.
Sample Input
Sample Output
解题
import java.util.Scanner;
public class HDU2051
{
//Bitset
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
while(s.hasNextInt())
{
int n=s.nextInt();
String m="";
while(n>0)
{
m=n%2+m;
n=n/2;
}
System.out.println(m);
}
}
}
求来波关注! 谢谢啦0.0!
小小小作者
@Fanny0602
题目
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
InputFor each case there is a postive number n on base ten, end of file.
OutputFor each case output a number on base two.
Sample Input
1 2 3
Sample Output
1 10 11
解题
import java.util.Scanner;
public class HDU2051
{
//Bitset
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
while(s.hasNextInt())
{
int n=s.nextInt();
String m="";
while(n>0)
{
m=n%2+m;
n=n/2;
}
System.out.println(m);
}
}
}
求来波关注! 谢谢啦0.0!
小小小作者
@Fanny0602
相关文章推荐
- Android之获取手机上的图片和视频缩略图thumbnails
- android string.xml文件中的整型和string型代替
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- Java 数据类型相互转换
- spring+shiro+自定义注解实现 数据层权限控制
- 我是运营,我没有假期
- 创维的风烛残年
- android上改变listView的选中颜色
- String.intern
- 13 个开源备份解决方案
- 3-unit1 IPv6网络的管理
- 虚拟化基础架构Windows 2008篇之10-使用WDS安装Windows 7
- 理解vSphere虚拟交换机中的VLAN类型
- 分享一下最近看的东西
- centos7 双网卡双网关的路由表配置
- 磁盘分区中MBR的模拟损坏及修复