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

啥也不说了!!!水题!!!!

代码:

#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip> using namespace std;
int lowbit(int x)
{
return x&(-x);
}
int main()
{ int n;
while(cin>>n&&n)
{
cout<<lowbit(n)<<endl;
}
return 0;
}

hdu 1196的更多相关文章

  1. hdu 1196 Lowest Bit

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1196 Lowest Bit Description Given an positive integer ...

  2. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  3. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  4. HDU ACM 题目分类

    模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...

  5. hdu Lowest Bit

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1196 大水题   lowbit   的应用    (可以取出一个数二进制中的最后一个1.树状数组常用, ...

  6. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  7. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  8. HDU 5687 Problem C(Trie+坑)

    Problem C Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Tota ...

  9. HDU 2578 Dating with girls(1) [补7-26]

    Dating with girls(1) Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

随机推荐

  1. poj3468 线段树+lazy标记

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 92921   ...

  2. Spring 学习笔记02

    用spring实现一个论坛基本功能 1 运行环境 Linux:Ubun 14.04 64bit IDE:IntelliJ IDEA 14.03 JDK:1.7.40 MySQL:5.5.44 Tomc ...

  3. twemproxy 安装

    twemproxy 安装 1. 获取安装包 shell> wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz shell> ...

  4. 判断Python输入是否为数字

    在接收raw_input方法后,判断接收到的字符串是否为数字 例如: str = raw_input("please input the number:") if str.isdi ...

  5. SQL建模错误--逗号分隔值

    最近帮一个客户分析SQL语句的问题,大致经过如下 场景: 委托方有一个用于追踪他们产品的系统,每个产品都会卖给许多客户:但是客户又被从业务上分成两类,一类是带有合作伙伴性质的,这个 合作伙伴通常会给予 ...

  6. iOS工程结构

          好的架构不是设计出来的,而是进化而来的! 写在前面 从2011年底开始学习iOS开发,到现在也已经快3年了,虽然中途没有一直进行iOS的开发(总是在Android和iOS间切换),但始终没 ...

  7. E​F​I​主​板​和​G​P​T​分​区​表​安​装​系​统以及转换GPT分区表的方法

    现在硬盘越来越大,而原来的MBR分区方式,超过2T的硬盘就会识别不全,只有使用GPT的方式才可以,但是GPT如果用原来的BIOS是无法引导装系统了,不过如果你的主板支持EFI,那么可以用GPT+EFI ...

  8. Eclipse快捷键集结

    Debug快捷键 F5单步调试进入函数内部.   F6单步调试不进入函数内部,如果装了金山词霸2006则要把“取词开关”的快捷键改成其他的.   F7由函数内部返回到调用处.   F8一直执行到下一个 ...

  9. 自制单片机之十五……可串行驱动LCD12864的应用

    在网上搜了一下,ST7920控制器的LCD产品可以提供8位,4位并行和串行接口可选,并行的控制接口的LCD较多,前面的贴子也介绍过,我们在这儿不说了,这儿我们讲的是串口控制LCD12864. 买了块S ...

  10. ASP.NET WEB API回发到客户端消息体的格式化

    首先基于SOA的消息通信基本都是按照一个统一的协议规范进行交互,那么必须定义消息体.不同的交互结构设计了不同的消息体. 业界统一使用的SOAP是一种规范的XML消息内容.例如在WCF中返回的结果. 随 ...