社区讨论
80pts WA on #3
P10448组合型枚举参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mdreiwja
- 此快照首次捕获于
- 2025/07/31 20:59 7 个月前
- 此快照最后确认于
- 2025/11/04 03:24 4 个月前
CPP
#include <bits/stdc++.h>
using namespace std;
int n,k,a[20];
bool vis[20];
void dfs(int x){
if(x==k+1){
for(int i=1;i<=k;i++){
cout<<a[i]<<" ";
}
cout<<"\n";
return;
}
for(int i=a[x-1];i<=n;i++){
if(!vis[i]){
vis[i]=1;
a[x]=i;
dfs(x+1);
vis[i]=0;
}
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>k;
a[0]=1;
dfs(1);
return 0;
}
报错提醒:wrong answer Too short on line 1.
回复
共 2 条回复,欢迎继续交流。
正在加载回复...