- 超时,满足40%的数据
#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
//第cnt次传球后,球在编号为x的同学手上
void dfs(int cnt, int x) {
if (cnt == m) {
if (x == 0) ans ++;
return;
}
dfs(cnt
这篇博客介绍了如何使用动态规划解决NOIP 2008普及组中的一道传球游戏问题。尽管原始解法导致了超时,但作者探讨了优化策略以应对40%的数据。
#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
//第cnt次传球后,球在编号为x的同学手上
void dfs(int cnt, int x) {
if (cnt == m) {
if (x == 0) ans ++;
return;
}
dfs(cnt
588
365
5734

被折叠的 条评论
为什么被折叠?