Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
139872 | 刘星辰liuxingchen | 组合问题 | C++ | 通过 | 100 | 6 MS | 244 KB | 469 | 2024-03-26 15:15:49 |
#include<bits/stdc++.h> using namespace std; int n; int m; bool used[30]; vector<int> path; void dfs(int now,int Min) { if(now==m) { for(int i=0;i<path.size();i++) { cout<<path[i]; } cout<<endl; return ; } for(int i=Min;i<=n;i++) { if(used[i]==0) { used[i]=1; path.push_back(i); dfs(now+1,i+1); used[i]=0; path.pop_back(); } } return ; } int main() { cin>>n; cin>>m; dfs(0,1); return 0; }