1.2.8 Lowest Bit
来源:互联网 发布:巨擎 巨擘 知乎 编辑:程序博客网 时间:2024/05/21 07:51
#include<iostream>#include<bitset>#include<cmath>using namespace std;int main(int argc, char* argv[]){int get, count;while(cin >> get){if(get == 0)return 1;bitset<8> bs(get);count = 0;int len = bs.size();int i = 0;for(;i < len-1 && !bs[i]; i++);cout << pow((double)2,i) << endl;}return 0;}
bitset reference
bitset的顺序居然是LSB在前,MSB在后,方便了,但是,不习惯。。。
下面是网上的,哎-->
#include<iostream>#include<algorithm>using namespace std;int main(){ for(int n;cin >> n && n!=0;) cout << int(n&-n) << endl; return 0;}
- 1.2.8 Lowest Bit
- HDU 1.2.6 Lowest Bit
- HDU 1.2.6 Lowest Bit
- Lowest Bit
- Lowest Bit
- 【Lowest Bit】
- Lowest Bit
- Lowest Bit
- Lowest Bit
- Lowest Bit
- Lowest Bit
- Lowest Bit
- Lowest Bit
- Lowest Bit
- Lowest Bit
- Lowest Bit
- Lowest Bit
- ACM STEP 1.2.7 Lowest Bit
- oracle常用操作2
- int.TryParse的使用
- Linux内核同步机制API函数:宏:spin_lock_init ( )
- hdu kmp 1711 Number Sequence
- oracle常用操作1
- 1.2.8 Lowest Bit
- iOS开发神器:Drawscript
- eclipse cdt unresolved inclusion 解决办法
- java日志,需要知道的几件事
- IIS修改上传附件大小后无法启动,错误代码-2145318902的解决方式
- codeforces 261B
- JSP的内置对象(application)
- 学习ASP编程必会的代码
- javaweb入门(5)-- 详细了解http协议3