hdu2051 Bitset
来源:互联网 发布:淘宝上可以卖膏药吗 编辑:程序博客网 时间:2024/05/21 10:14
Bitset
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 21497 Accepted Submission(s): 15952
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
123
Sample Output
11011
十进制转二进制,位操作实现
#include<iostream>#include<cstdio>using namespace std;int main(){int n;while(cin>>n){int cur=1<<10;while(!(cur&n))cur>>=1;//忽略无效的0 while(cur)//从第一个非0的位开始一位一位输出 {printf("%d",!!(cur&n));//打印每一位的值 cur>>=1;}printf("\n");}return 0; }
0 0
- hdu2051 bitset
- HDU2051 Bitset
- HDU2051 Bitset
- HDU2051 Bitset
- hdu2051 Bitset
- HDU2051 Bitset
- HDU2051(栈)Bitset
- hdu2051 Bitset(C语言)
- Hdu2051 *** Bitset (十进制化二进制)
- hdu2051
- hdu2051
- HDU2051
- hdu2051 Bitset (十进制转化为二进制) java
- bitset
- bitset
- BitSet
- bitset
- bitset
- 以太网自动协商原理
- 转载环球时报:在中国,骂卡斯特罗的是些什么人
- 搭建持续集成接口测试平台(Jenkins+Ant+Jmeter)
- DB9公母头引脚定义以及连接
- Python写出LSTM-RNN(Long-Short Term Memory Recurrent Neural Networks )的代码
- hdu2051 Bitset
- Cocos Creator中使用对象池(官方文档摘录)
- Bus error (core dumped) 和jps命令
- 制作可执行jar文件包
- 机器学习实战学习笔记5——主成分分析(PCA)
- Jmeter调试工具---Debug Sampler
- JdbcTemplate带in参数的写法
- JAVA设计模式之单例模式
- lua中实现一个 point Vector