Hdoj 1196 Lowest Bit 【&】
来源:互联网 发布:辐射2中文版 mac 编辑:程序博客网 时间:2024/05/29 13:11
Lowest Bit
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9273 Accepted Submission(s): 6824
Problem Description
Given an positive integer A (1 <= A <= 100), output the lowest bit of A.
For example, given A = 26, we can write A in binary form as 11010, so the lowest bit of A is 10, so the output should be 2.
Another example goes like this: given A = 88, we can write A in binary form as 1011000, so the lowest bit of A is 1000, so the output should be 8.
Input
Each line of input contains only an integer A (1 <= A <= 100). A line containing “0” indicates the end of input, and this line is not a part of the input data.
Output
For each A in the input, output a line containing only its lowest bit.
Sample Input
26
88
0
Sample Output
2
8
题意:输出转换成二进制的非0位
代码:
#include <cstdio>#include <iostream>using namespace std;int main(){ int a; while(cin >>a, a){ cout << (a&(-a)) <<endl; } return 0;}
- hdoj 1196 Lowest Bit
- 【HDOJ】1196 -> Lowest Bit
- HDOJ 1196 Lowest Bit
- hdoj 1196 Lowest Bit
- HDOJ 1196 Lowest Bit
- hdoj 1196 Lowest Bit
- Hdoj 1196 Lowest Bit 【&】
- hdoj.1196 Lowest Bit 20140815
- hdoj 1196 Lowest Bit (二进制)
- HDOJ 1196 Lowest Bit(水题)
- HDOJ 1196 Lowest Bit(树状数组实现)
- hdoj 1196 Lowest Bit(水题)
- HDOJ 1196:Lowest Bit——用位操作求解
- HDOJ 1196 Lowest Bit(二进制相关的简单题)
- HDU 1196 Lowest Bit
- HDU 1196 ( Lowest Bit )
- Problem - 1196 : Lowest Bit
- HDU 1196 Lowest Bit
- SQL连接
- 黑马程序员——Java基础---多线程
- 华为机试-整数化成2进制数
- 带负权的最短路bellman_ford——POJ 3259 Wormholes题解
- Windows Oracle ODBC 安装配置
- Hdoj 1196 Lowest Bit 【&】
- 原文地址http://www.cnblogs.com/biyeymyhjob/archive/2012/07/12/2588074.html
- 黑马程序员--------JAVA基础IO
- 第三章第十题
- string基本字符容器
- 内存泄露和内存溢出
- Android中使用PULL方式解析XML文件
- 解决apache启动失败:Job for httpd.service failed.
- 抽象类和接口区别