'commit'
This commit is contained in:
21
TangDou/AcWing/SegmentTree/tangdou.cpp
Normal file
21
TangDou/AcWing/SegmentTree/tangdou.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int n, m;
|
||||
void dfs(int u, string s,int pre ){
|
||||
if(u==m+1){
|
||||
cout << s << endl;
|
||||
return;
|
||||
}
|
||||
for (int i = pre+1; i <=n ; i++){
|
||||
if(s=="")
|
||||
dfs(u + 1, to_string(i), i);
|
||||
else
|
||||
dfs(u + 1, s + " " + to_string(i), i);
|
||||
}
|
||||
}
|
||||
int main() {
|
||||
cin >> n >> m;
|
||||
dfs(1, "", 0);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user