首先,您的函数在后三种情况下都没有返回值
其次,应该先判断是否有数超过 20 再判断是否记忆过这个函数值,否则还是会爆
by StarLbright40 @ 2022-06-18 19:11:22
你不能把x,y,z先减了再输出啊……
by _maojun_ @ 2022-06-18 19:13:30
@[星光0000](/user/128570) 第一个是我的错,但是第二个,我再输入那里加了这几行:
```cpp
if(x > 20) x = 21;
if(y > 20) y = 21;
if(z > 20) z = 21;
```
还有那个,我样例输出是对的,不知道为什么
by achjuncool @ 2022-06-18 19:14:10
while里应改为
```cpp
printf("w=(%lld,%lld,%lld)=%lld\n",x,y,z,func(min(21,x), min(21,y), min(21,z)));
```
by _maojun_ @ 2022-06-18 19:14:57
@[achjuncool](/user/604622)
by _maojun_ @ 2022-06-18 19:15:25
@[_maojun_](/user/350297) 啊这有道理我改下
by achjuncool @ 2022-06-18 19:15:56
哦对,min里面要的21要加ll
```cpp
func( min(21ll,x),min(21ll,y),min(21ll,z) )
```
by _maojun_ @ 2022-06-18 19:17:10
@[achjuncool](/user/604622) 还有就是
x,y,z,都可能为-1,只有全是-1时才能结束,所以应该用或逻辑;
x,y,z都可能是大负数,所以应该$\max(0,x)$
```cpp
for(scanf("%lld%lld%lld",&x,&y,&z);x!=-1||y!=-1||z!=-1;scanf("%lld%lld%lld",&x,&y,&z))
printf("w(%lld, %lld, %lld) = %lld\n",x,y,z,dfs(min(21ll,max(0ll,x)), min(21ll,max(0ll,y)), min(21ll,max(0ll,z))));
```
by _maojun_ @ 2022-06-18 19:30:47
@[achjuncool](/user/604622) 所以你最后还是没有返回值……
by _maojun_ @ 2022-06-18 19:32:07
@[_maojun_](/user/350297) 你这玩意我看着有点头晕((不是我一会会看得懂的((
by achjuncool @ 2022-06-18 19:39:41