1 solutions

  • 1
    @ 2026-6-7 14:48:45
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int l,r;
    	cin>>l>>r;
    	int cnt=0;
    	for(int n=l;n<=r;n++)
    	{
    		//判断2^x+2^y==n  pow(a,b)=>a^b
    		int c=0;
    		for(int x=0;pow(2,x)<=n;x++)
    		{
    			for(int y=0;pow(2,y)<=n;y++)
    			{
    				if(pow(2,x)+pow(2,y)==n)
    				{
    					c=1;
    				}
    			}
    		}
    		if(c==1)
    		{
    			cnt++;
    		}
    	} 
    	cout<<cnt;
    	return 0;
    }
    
    
    • 1

    Information

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