Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
593 B
2
Indexable
Never
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
bool socb(int x){
    int cntc = 0, cntl = 0;
    while(x > 0){
        int a = x%10;
        if(a % 2 == 1) cntl++;
        else cntc++;
        x/=10;
    }
    if(cntc == cntl) return true;
    return false;
}
int main(){
    int n; cin >> n;
    int cnt = 0;
    for(int i = pow(10,n-1); i < pow(10,n); i++){
        if(socb(i)){
            cout << i << " ";
            cnt++;
        }
        if(cnt == 10){
            cout << endl;
            cnt = 0;
        }
    }
    return 0;
}