dfs 0pts help!

P1048 [NOIP2005 普及组] 采药

@[love20110429](/user/1095806) 额,这题正解是 dp()
by wzj0829 @ 2024-05-09 18:05:18


@[wzj0829](/user/1028403) 但是我们课程要求用dfs做30pts,可是我这0pts
by love20110429 @ 2024-05-09 21:42:34


@[wzj0829](/user/1028403) ``` void dfs(int x,int nowtime,int worth){ if (nowtime > t) return; ans = std::max(ans,worth); if (x > m) return; dfs(x + 1,nowtime,worth); dfs(x + 1,nowtime + a[x].times,worth + a[x].worth); } ``` 如你所愿,只能30pts
by asd890123 @ 2024-06-08 12:55:18


|