@[yyb18660335329](/user/749958) 多计数了,
by onlyfiee @ 2023-10-01 20:43:28
比如你一开始选择了正确的方案,但是你后面多计数了
比如输入
3 10 20
5 5 1
答案是 1 ,而你是6
by onlyfiee @ 2023-10-01 20:48:27
```
void dfs(int x,int y){
if(y>r) return;
if(x>n)//判断食物是否取完
{
if(y>=l&&y<=r) ans++;
return;
}
dfs(x+1,y+w[x]);
dfs(x+1,y);
return;
}
```
by sandwich03 @ 2023-10-01 20:48:35
改成这样 @[yyb18660335329](/user/749958)
by sandwich03 @ 2023-10-01 20:49:07
就是后面的不选择也被统计成方案了
by onlyfiee @ 2023-10-01 20:49:11
答案是2
by onlyfiee @ 2023-10-01 20:50:45
@[linzhi123](/user/796403) @[onlyfiee](/user/826691) 一关,感谢
by yyb18660335329 @ 2023-10-02 08:01:57
@[linzhi123](/user/796403) 大佬能详细解释一下为什么只有搜索完的情况是满足的,也是这个错误,没想明白,求教了。
by ping_lanjiu @ 2024-03-14 21:27:29