2 solutions

  • 1
    @ 2026-10-11 14:39:28
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int l,r;
        cin>>l>>r;
        int cnt = 0;
        for(int i=l;i<=r;i++){
            int flag = 0;
            for(int x = 0;x<=15;x++){
                for(int y = 0;y<=15;y++){
                    if(i==pow(2,x)+pow(2,y)){
                        flag= 1;
                    }
                }
            }
            if(flag == 1) cnt++;
        }
        cout<<cnt;
    return 0;
    }
    

    Information

    ID
    2806
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    126
    Accepted
    34
    Uploaded By