@[HappyDavid](/user/738761) 调试信息不用管!
by HappyDavid @ 2023-07-16 14:45:59
wssb,<0判断应该在记忆化判断前面,但是死循环了?
by HappyDavid @ 2023-07-16 14:59:44
@[HappyDavid](/user/738761) 还有>20判断,但是这似乎并不影响死循环……
by HappyDavid @ 2023-07-16 15:02:37
好了,if (a < 0 || b < 0 || c < 0) return w (0, 0, 0);应该改成if (a <= 0 || b <= 0 || c <= 0) return 1;。
by HappyDavid @ 2023-07-16 15:23:40
<=0?
by sssscy_free_stdio @ 2023-07-16 15:26:37
试一下,我代码写的是<=0,过了
by sssscy_free_stdio @ 2023-07-16 15:27:42
还是RE*ALL……
[记录](https://www.luogu.com.cn/record/115847174)
代码:
```cpp
#include <bits/stdc++.h>
using namespace std;
long long w_res[21][21][21], x, y, z, i, j, k;
#define w_res_init_num -9223372036854775808
long long w(long long a, long long b, long long c) {
printf ("[wsDbg][Line5][clock%d] a=%lld,b=%lld,c=%lld,w_res[a][b][c]=%lld\n", clock(),a,b,c,w_res[a][b][c]);
if (a <= 0 || b <= 0 || c <= 0) return 1;
if (a > 20 || b > 20 || c > 20) return w (20, 20, 20);
if (w_res[a][b][c] != w_res_init_num) return w_res[a][b][c];
if (a < b && b < c) w_res[a][b][c] = w (a, b, c - 1) + w (a, b - 1, c - 1) - w (a, b - 1, c);
else w_res[a][b][c] = w (a - 1, b, c) + w (a - 1, b - 1, c) + w (a - 1, b, c - 1) - w (a - 1, b - 1, c - 1);
return w_res[a][b][c];
}
int main() {
for (i = 0; i < 21; i++) for (j = 0; j < 21; j++) for (k = 0; k < 21; k++) w_res[i][j][k] = w_res_init_num;
while (true) {
scanf ("%lld%lld%lld", &x, &y, &z);
if (x == -1 && y == -1 && z == -1) break;
else printf ("w(%lld, %lld, %lld) = %lld\n", x, y, z, w (x, y, z));
}
return 0;
}
```
by HappyDavid @ 2023-07-16 15:29:29
不用把w_res数组全部写成-9223372036854775808,直接写成0,判断的时候判断w_res[a][b][c] >0就行了,而且RE的话数组开大点?开到30试试
by sssscy_free_stdio @ 2023-07-16 15:33:31
不一定对(我是个大蒟蒻)
by sssscy_free_stdio @ 2023-07-16 15:35:47
对吗?
by sssscy_free_stdio @ 2023-07-16 15:37:07