当前位置:网站首页>J. Balanced Tree
J. Balanced Tree
2022-06-11 03:29:00 【to cling】
2022 Jiangsu Collegiate Programming Contest
Solution




Code
#define ll unsigned long long int
ll dfs(ll x, ll a, ll b, ll c)
{
if (x == 0) return 0;
if (x == 1) return c;
if (x & 1) return dfs(x >> 1, a * 2 + b, b, c + b);
else return dfs(x >> 1, a, a + b * 2, c + a);
}
int main()
{
IOS;
int T; cin >> T;
while (T--)
{
ll ans = 1;
ll n; cin >> n;
ll c = dfs(n, 1, 0, 0);
if (c >= 64) ans = 0;
else ans <<= c;
cout << ans << endl;
}
return 0;
}
边栏推荐
- Unity's data persistence -- Jason
- The key data of music genuine rate is missing. What is the odds of Netease cloud music IPO?
- Product milestones in May 2022
- CheckBox美化按钮选中样式
- js顶部图标菜单点击切换背景色js特效
- Vocabulary Construction -- code completion fast food tutorial (3) - word segmentation
- canvas+svg线条粒子动画网页背景
- Disk quota exceeded
- 计算机视觉(AI)面试大全
- SQL | some indicators of the game industry
猜你喜欢

OpenGl第十章 投光物

three.js炫酷科技感背景h5动画

The tide play power is really firepower! The first big screen cinema for young people? Cool open TV Max 86 "sudden attack

Unity之数据持久化——Json

Promise使用

Instructor add function_ Enable auto fill_ Instructor modification function

Demand and Prospect of 3D GIS Industry

Configuring the command line compiled environment -msvc

MySQL learning notes: JSON nested array query

亚马逊测评自养号,小白应该如何开始?
随机推荐
用Fragment实现图片简易浏览
OpenGL第十一章 多光源
TimeHelper
ThoughtWorks.QRCode功能齐全的生成器
The tide play power is really firepower! The first big screen cinema for young people? Cool open TV Max 86 "sudden attack
Start QQ through the program to realize automatic login
Opencv实现纵横比保持的图像缩放
If the source code of the home page module is not separated ----- > nanny level source code analysis (1)
Lvgl Chinese font production
Log4j use
canvas交互式星星动画背景js特效
计算机视觉(AI)面试大全
A simple understanding of C language array
【ELT.ZIP】OpenHarmony啃论文俱乐部——数据高通量无损压缩方案
Checkbox beautify button selected style
多线程四部曲之NSThread
【ELT.ZIP】OpenHarmony啃论文俱乐部——快速随机访问字符串压缩
canvas绘图——如何把图形放置画布中心
蓄力618 ,苏宁如何打下这场硬仗?
【安全科普】今天你被社工了吗?