/*
二进制最后一个1的位置,如果最后一位是1,那么是奇数,
如果最后一位是0,那么是偶数。
相似的分析,如果倒数第2位为1一定是2的倍数
如果倒数第3位是1一定是4的倍数
*/
#include <cstdio>int main()
{int a;while(scanf("%d", &a), a){int s = 1;for(int l = 1; ;l++){s *= 2;if(a % s){printf("%d\n", s/2 );break;}}}return 0;
}
详细解决方案
zoj 2417 Lowest Bit
热度:54 发布时间:2023-12-11 20:53:59.0
相关解决方案
- PAT - 甲级 - 1106. Lowest Price in Supply Chain (25)(多叉树)
- HDU--2028-Lowest Common Multiple Plus
- HDOJ 1196 Lowest Bit(水题)
- LintCode 578 Lowest Common Ancestor III
- LeetCode 235 Lowest Common Ancestor of a Binary Search Tree
- Leetcode 235/236 Lowest Common Ancestor
- HDU-1196(lowest bit)
- 杭电 2028 Lowest Common Multiple Plus
- leetcode 236. Lowest Common Ancestor of a Binary Tree(python)
- POJ 2417 Discrete Logging(BSGS算法,gcd(a,p)=1)
- PAT Advanced1106 Lowest Price in Supply Chain(树,DFS)
- zoj 2417 Lowest Bit
- HDU2028 Lowest Common Multiple Plus(最小公倍数)
- 1106 Lowest Price in Supply Chain (25 分) DFS
- [PAT A1106]Lowest Price in Supply Chain
- 面试题50 树中两个节点的最低公共祖先LCA(Lowest Common Ancestor )
- 个人练习-PAT甲级-1106 Lowest Price in Supply Chain
- leetcode 236. Lowest Common Ancestor of a Binary Tree (medium)
- 1143. Lowest Common Ancestor (30) 最近公共祖先
- hdu - 1196 - Lowest Bit(bitset)
- hdu - 2028 - Lowest Common Multiple Plus
- PAT_A 1106. Lowest Price in Supply Chain (25)
- 22 最近共同先祖(Lowest Common Ancestor of a Binary Tree)
- poj 2417 Discrete Logging 数论baby_step,giant_step算法
- HDU - Lowest Common Multiple Plus
- PAT-1106 Lowest Price in Supply Chain
- PAT甲级题目1106 Lowest Price in Supply Chain
- 【Leetcode&C语言】235. Lowest Common Ancestor of a Binary Search Tree
- PAT甲级1143 Lowest Common Ancestor (30分)|C++实现