1 条题解
-
0
枚举
枚举指数 的值,判断幂数之和是否在范围内。因为枚举指数所以只需要 的范围即可。
#include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL, LL> PII; #define x first #define y second const int N = 2e5 + 10, M = 60; void solve() { int x, y; cin >> x >> y; int ans = 0; for(int i = 0; i <= 20; i ++) for(int j = i; j <= 20; j ++) { int t = (1 << i) + (1 << j); if(t <= y && t >= x) ans ++; } cout << ans << endl; } int main() { int t = 1; // cin >> t; while(t --) solve(); }
- 1
信息
- ID
- 200
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 14
- 已通过
- 7
- 上传者