1 solutions

  • 0
    @ 2025-4-22 15:49:05

    找最高位不大于 nn 的即可

    #include<bits/stdc++.h>
    using namespace std;
    #define int long long
    signed main()
    {
        int n;
        cin>>n;
        int x=1;
        while(x<<1 <=n)
            x<<=1;
        cout<<x<<endl;
    }
    
    • 1

    Information

    ID
    1459
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    7
    Tags
    # Submissions
    222
    Accepted
    50
    Uploaded By