ZOJ Monthly, January 2019 - A Little Sub and Pascal's Triangle(找規律)
Lucas定理:
2的p次方,p為n-1二進位制中1的個數
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
int main()
{
ll n;
int t;
scanf("%d",&t);
while (t--)
{
scanf("%lld",&n);
ll cnt=0;
n--;
while (n)
{
if(n&1)
cnt++;
n>>=1;
}
ll ans=1ll<<cnt;
printf("%lld\n",ans);
}
return 0;
}
相關文章
- 119 Pascal's Triangle II
- ZOJ Monthly, March 2018
- 打表找規律
- HDU 6298 Maximum Multiple(找規律)
- HUNAN -11566 Graduation Examination(找規律)NaN
- LeetCode-6. Z字形變換(找規律)LeetCode
- HDU-6415 Rikka with Nash Equilibrium (DP/找規律)UI
- Touring cities (找規律 哈密爾頓迴路)
- Gym - 101532A Subarrays Beauty(位操作找規律)
- HDU 5795 A Simple Nim (SG函式+打表找規律)函式
- HDU 6415(dp/找規律-2018多校第九場1001)
- QOJ7789-一道位運算找規律好題
- ZOJ2019年1月月賽
- zoj
- 【LeetCode動態規劃#04】不同的二叉搜尋樹(找規律,有點像智力題)LeetCode動態規劃
- Modern Pascal is Still in the Race (Modern Pascal 仍在競賽中)
- leedcode-單詞規律
- 三、凸透鏡成像規律
- LeetCode-單詞規律LeetCode
- LeetCode-290-單詞規律LeetCode
- How to add sub-repo as sub-module
- [LeetCode] 120. TriangleLeetCode
- ZOJ 3732 Graph ReconstructionStruct
- Diablo III ZOJ - 3769
- ZOJ - 2112 Dynamic Rankings
- HDU 2197 本原串 (規律+快速冪)
- 快三長龍有規律嗎?
- Java欄位初始化規律Java
- 如何探索事物的客觀規律?
- 圖片跨域規律探尋跨域
- 最佳化配置Little Snitch for Mac的規則和設定Mac
- 24點 Pascal大暴力程式
- ZOJ4043 : Virtual Singers
- Windows下編譯TriangleWindows編譯
- LINUX下編譯TriangleLinux編譯
- python3 中 and 和 or 運算規律Python
- ●連續質數2.3.5.7.11.13.17.19的規律●(9)
- ●連續質數2.3.5.7.11.13.17.19的規律●(6)