1 solutions

  • 0
    @ 2023-4-4 0:26:44

    利用位运算的性质求每一位上为0还是1

    #include <bits/stdc++.h>
    using namespace std;
    
    #define endl '\n'
    #define LL long long
    #define ph push_back
    #define INF 0x3f3f3f3f
    #define PII pair<int, int>
    
    int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    for(int i=0;i<=31;i++){
    for(int j=4;j>=0;j--){
    cout<<(i>>j&1);
    }
    cout<<endl;
    }
    
    return 0;
    }
    
    • 1

    Information

    ID
    1821
    Time
    1000ms
    Memory
    512MiB
    Difficulty
    4
    Tags
    # Submissions
    21
    Accepted
    15
    Uploaded By