5 solutions

  • 1
    @ 2022-4-5 1:12:36

    我水平不够,于是就暴力求解

    #include <iostream>
    using namespace std;
    int main()
    {
        int T = 0;
        cin >> T;
        while(T--)
        {
            int n = 0;
            cin >> n;
            if(n == 1 || n == 2) 
            {
                cout << "YES" << endl;
                continue;
            }
            if(n%2) cout << "NO" << endl;
            else
            {
                while(n>2)
                {
                    n /= 2;
                    if(n % 2) break;
                }
                if(n==2)    cout << "YES" << endl;
                else cout << "NO" << endl;
            }
        }
        return 0;
    }
    

    Information

    ID
    47
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    1493
    Accepted
    232
    Uploaded By