UVALive 6527 Counting ones dfs(水
来源:互联网 发布:流放之路腾讯优化差 编辑:程序博客网 时间:2024/05/16 11:24
题目链接:点击打开链接
#include <cstdio>#include <vector>using namespace std;typedef long long ll;ll re;vector<int> p;void dfs(int dep, int g) {if (dep == 0)return ;if (p[dep-1] == 1) {re += (dep-1) * (1ll<< (dep-2));re += g * (1ll << (dep-1));}dfs(dep-1, g+p[dep-1]);}ll C(ll x) {if (x == 0)return 0;p.clear();re = 0;while (x>0) {p.push_back(x%2);x /= 2;}for (int i = 0; i < (int)p.size(); ++i)re += p[i];dfs(p.size(), 0);return re;}int main() {ll A, B;while (~scanf("%lld%lld", &A, &B))printf("%lld\n", C(B) - C(A-1));return 0;}
0 0
- UVALive 6527 Counting ones dfs(水
- UVALive 6527 Counting ones
- 【瞎搞】 UVALive 6527 Counting ones
- Live Archive 6527 Counting ones
- Counting Ones
- LA 6527 Counting ones 数位dp
- pat 1049 Counting Ones
- 1049. Counting Ones
- 1049. Counting Ones (30)
- PAT 1049 Counting Ones
- pat 1049 Counting Ones
- 1049. Counting Ones (30)
- 1049. Counting Ones (30)
- pat 1049 Counting ones
- 1049. Counting Ones (30)
- 1049. Counting Ones (30)
- 1049. Counting Ones
- 1049. Counting Ones (30)
- 关于C# WinForm中进度条的实现方法
- android开发小文章——蓝牙的使用
- C# winform 使用进度条(两种形式)
- JAVA的文件操作【转】
- Azure storage blob rename by SDK development
- UVALive 6527 Counting ones dfs(水
- 程序员的进化 - 在拉勾1024程序员节上的演讲
- 小沐Andorid下面的MD5详细实现思路小结
- UVALive 6529 Eleven 区间dp
- CodeVs 2054 货币系统
- 怎样利用Serv-U建立FTP站点
- 使用 Boost 的 IPC 和 MPI 库进行并发编程
- 更新客户配置文件
- 汽车百科系列之(一): 大话汽油