HDU5587
来源:互联网 发布:淘宝客服问题总结 编辑:程序博客网 时间:2024/06/05 03:33
#include<iostream>#include<queue>#include<stack>#include<string>#include<algorithm>using namespace std;long long fun(long long n);int main(){ long long n,i; long long t; while (cin >> t) { for (i = 0; i < t; i++) { cin >> n; cout << fun(n + 1) << endl; } } return 0;}long long fun(long long n){ if (n == 1)return 0; else { long long j = 1; while (1) { j *= 2; if (j >= n)break; } if (j == n)return 2 * fun(j / 2) + j / 2; else { j /= 2; return fun(j)+n-j+fun(n-j); } }}
0 0
- HDU5587
- hdu5587 BestCoder Round #64 (div.2)
- 【HDU5587 BestCoder Round 64 (div1)B】【迭代 前缀和思想】Array 前m个数的二进制中共有多少个1
- VMware虚拟机下安装原版XP外文系统
- iOS最简单绘图实现
- Android自定义相机方法及保存照片方式
- hdu5587 BestCoder Round #64 (div.2)
- 【HDU5583 2015上海赛区L】【找规律 正难则反】LCM Walk 目标状态(x,y)哪些点走公倍数能走到它
- HDU5587
- hdoj 5587 Array 【思维】
- asp.net中使用getElementById的注意点
- NEUQOJ 1495 田鼠看热闹(Ⅰ)(枚举 + 模拟)
- 利用OpenCV找到图片中的乒乓球,返回球的圆心及半径,去除图片中非感兴趣区域
- iOS中为什么block用copy来修饰
- OpenGL+Visual Studio 2010开发环境搭建
- bzo j3122: [Sdoi2013]随机数生成器
- final TextView textView= (TextView) findViewById(R.id.text1);