Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n, m, k, cnt = 0;
- int a[10005];
- void Try(int i, int cur)
- {
- if (i == n)
- {
- cnt++;
- if (cnt == m)
- {
- for (int j = 0; j < n; ++j)
- {
- cout << a[j] << ' ';
- }
- }
- return;
- }
- if (cur < k - 1)
- {
- a[i] = 0;
- Try(i + 1, k + 1);
- }
- a[i] = 1;
- Try(i + 1, 0);
- }
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cin >> n >> m >> k;
- Try(0, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement