简单枚举
2026-08-16 19:33:12
发布于:北京
1阅读
0回复
0点赞
直接枚举
#include <bits/stdc++.h>
using namespace std;
int main() {
int l,r,cnt=0;
cin>>l>>r;
for(int x=0;xx<=r;x++){
for(int y=x;yy<=r;y++){
int i=pow(2,x)+pow(2,y);
if(i>=l&&i<=r) cnt++;
}
}
cout<<cnt;
return 0;
}
这里空空如也

有帮助,赞一个