赛时AC,现在60
查看原帖
赛时AC,现在60
1444395
McdullWang楼主2025/6/30 12:46

TLE,60分

#include <bits/stdc++.h>
using namespace std;
#define int long long
bool pd(int a){
    for(int i=0;i<=sqrt(a);i++){
        for(int j=0;j<=sqrt(a);j++){
            if(pow(2,i)+pow(2,j)==a){
                return 1;
            }
        }
    }
    return 0;
}
signed main(){
    int l,r,s=0;
    cin>>l>>r;
    for(int i=l;i<=r;i++){
        if(pd(i)){
            s++;
        }
    }
    cout<<s;
}
2025/6/30 12:46
加载中...