G
来源:互联网 发布:vk俄罗斯社交软件 编辑:程序博客网 时间:2024/05/16 07:11
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.
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.
26880
28函数 low bit=n&(-n)
#include<stdio.h>int main(){int n;while(scanf("%d",&n)!=EOF){if(n==0)break;printf("%d\n",n&(-n));}}
阅读全文
0 0
- G#
- g
- G++
- g
- g
- g
- g
- G
- g++
- g
- G
- g++
- G
- G - 。。。。。。。
- g
- G
- G
- G
- 常用表 Catalan(卡特兰)数 1
- C语言Array_List简单实现
- ZOJ
- jqueryui autocomplete结合AJAx实现自动补全
- 数据挖掘 你必须知道的32个经典案例(电子书)
- G
- 【前端知识点】跨域之跨域window.postMessage
- PHP中异常处理机制快速入门案例
- pytorch 数据集图片显示
- 分页
- sql server 2008 从旧表复制表结构和数据到到新的表(没有表结构和数据)
- 学习随笔——Java类和对象小例子
- UNP(卷2:进程间通信)—— 第12章:共享内存区介绍
- 关于<context:property-placeholder>的一个有趣现象