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. C#使用itextsharp生成PDF文件

    项目需求需要生成一个PDF文档,使用的是VS2010,ASP.NET. 网络上多次搜索没有自己想要的,于是硬着头皮到itextpdf官网看英文文档,按时完成任务,以实用为主,共享一下: 使用HTML文 ...

  2. windows启动、停止和重新启动Apache服务

    启动.停止和重新启动Apache服务(1) 在Windows操作系统中,Apache一般以服务的方式运行.在安装Apache时,如果你选择了“for all users”,Apache就会自动安装为一 ...

  3. Django Meta内部类选项

    http://blog.csdn.net/yelbosh/article/details/7545335

  4. php 之 PDO数据访问抽象层(0513)

    PDO(PHP Data Objects)是一种在PHP里连接数据库的使用接口. PDO与mysqli曾经被建议用来取代原本PHP在用的mysql相关函数, 基于数据库使用的安全性,因为后者欠缺对于S ...

  5. XML DOM 遍历Xml文档

    1.xml文档内容: <?xml version="1.0" encoding="utf-8" ?> <bookstore> <b ...

  6. spring动画-iOS-备

    最后停止在终点: 如果给位置移动的动画添加弹簧效果,那么视图的运动轨迹应该像下图中展现的一样: 这会使你的动画看起来更逼真.更真实.更贴近现实.在某些情况下带给用户更好的用户体验.那么让我们开始学习吧 ...

  7. [每日一题jQuery] jQuery选择器总结:进一步过滤、同级操作、后代操作

    jQuery选择器继承自CSS的风格,可以通过jQuery选择器找出特定的DOM元素,在此基础上对该元素做相应处理.jQuery不仅支持简单的标签选择器.类选择器.id选择器,还针对表单状态.子元素. ...

  8. Spinner 实现key value 效果

    在使用Spinner进行下拉列表时,我们一般都会使用字符串数组的方式加ArrayAdapter,取到的列表值就是我们所看到的Text.如果我们想实现网页中select <option value ...

  9. Codeforces 527D Clique Problem

    http://codeforces.com/problemset/problem/527/D 题意:给出一些点的xi和wi,当|xi−xj|≥wi+wj的时候,两点间存在一条边,找出一个最大的集合,集 ...

  10. cf442C Artem and Array

    C. Artem and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard ...