4 solutions

  • 0
    @ 2025-11-8 15:55:38
    #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++){
    		bool a=0;
    		for(int x=0;x<=15;x++){
    			for(int y=0;y<=15;y++){
    				if(pow(2,x)+pow(2,y)==i){
    					a=1; 
    				}
    			}
    		}
    		if(a==1){
    			cnt++;
    		}
    	}
    	cout<<cnt;
    	return 0;
    }
    

    Information

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