1 条题解

  • 0
    @ 2025-9-10 8:58:58

    C++ :

    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    
    int main()
    {
        int t;
        cin>>t;
        while(t--)
        {
            long long l,r;
            cin>>l>>r;
            while((l|(l+1))<=r)
            {
                l=(l|(l+1));
            }
            cout<<l<<endl;
        }
    
        return 0;
    }
    
    
    • 1

    信息

    ID
    3505
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者