幂和数代码
查看原帖
幂和数代码
1777454
Yansuo1楼主2025/8/31 20:09

幂和数代码

#include <bits/stdc++.h>
using namespace std;
int main(){
    int l,r,n,m =0;
    cin>>l>>r;
    for(int i=0;pow(2,i)<r;i++){
        for(int j=i;pow(2,j)<r;j++){
            if((n=pow(2,i)+pow(2,j))<=r&&(n=pow(2,i)+pow(2,j))>=l){
                m+=1;
            }
}
}
    cout<<m;
    return 0;
}
2025/8/31 20:09
加载中...