Created
August 31, 2019 05:47
-
-
Save surinoel/026db85749941a6d7711ea89e6494326 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
using namespace std; | |
int n, m; | |
void go(int idx, int maxcnt, vector<int> v) { | |
if (maxcnt == m) { | |
for (int i = 0; i < v.size(); i++) { | |
cout << v[i] << ' '; | |
} | |
cout << '\n'; | |
return; | |
} | |
for (int i = idx; i <= n; i++) { | |
v.push_back(i); | |
go(i, maxcnt + 1, v); | |
v.pop_back(); | |
} | |
return; | |
} | |
int main(void) { | |
ios_base::sync_with_stdio(false); | |
cin.tie(nullptr); | |
cin >> n >> m; | |
go(1, 0, vector<int>()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment