社区讨论
请问这道题怎么用深搜做
P1044[NOIP 2003 普及组] 栈参与者 7已保存回复 9
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 9 条
- 当前快照
- 1 份
- 快照标识符
- @mi6vqhny
- 此快照首次捕获于
- 2025/11/20 11:36 4 个月前
- 此快照最后确认于
- 2025/11/20 11:36 4 个月前
CPP
#include<iostream>
using namespace std;
int n,book[20],ans;
void dfs(int xh,int top)
{
top++;
if(xh==n)
{
ans++;
return ;
}
if(xh<n)
{
dfs(xh+1,top);
dfs(xh+1,top-1);
}
return ;
}
int main()
{
cin>>n;
dfs(1,0);
cout<<ans;
return 0;
}
哪位好心人看一下哪儿不对
回复
共 9 条回复,欢迎继续交流。
正在加载回复...