@[Jason_LiDongJin](/user/751572) `if (a <= 100 && b <= 100 && c <= 100 && f[a][b][c])`
为什么要a<=100……
by heike305 @ 2023-02-21 16:49:04
```cpp
if (a > 20 || b > 20 || c > 20)
return f[a][b][c] = w(20, 20, 20);
```
改成
```cpp
if (a > 20 || b > 20 || c > 20)
return w(20, 20, 20);
```
by heike305 @ 2023-02-21 16:50:26
@$heike305$
$范围太大$$, $$直接$$f[a][b][c]$$会$$RTE$
$QwQ$
by Jason_LiDongJin @ 2023-02-21 16:59:35
@[Jason_LiDongJin](/user/751572)
```cpp
#include <bits/stdc++.h>
using namespace std;
int f[25][25][25];
int w(int a, int b, int c) {
if (a <= 0 || b <= 0 || c <= 0)
return 1;
if (a > 20 || b > 20 || c > 20)
return f[a][b][c] = w(20, 20, 20);
if (f[a][b][c])
return f[a][b][c];
if (a < b && b < c)
return f[a][b][c] = (w(a, b, c - 1) + w(a, b - 1, c - 1) - w(a, b - 1, c));
return f[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);
}
int main() {
int x, y, z;
while (cin >> x >> y >> z) {
if (x == -1 && y == -1 && z == -1)
break;
cout << "w(" << x << ", " << y << ", " << z << ") = " << w(min(x, 21), min(y, 21), min(z, 21)) << "\n";
}
return 0;
}
```
by Loser_Syx @ 2023-02-21 17:20:14
@[Jason_LiDongJin](/user/751572) 帮你改了改,能AC
by Loser_Syx @ 2023-02-21 17:20:30
@[Jason_LiDongJin](/user/751572) 你放那么多$干嘛
by heike305 @ 2023-02-21 17:23:50
@[mooktian](/user/890321) 你脑*吗,我操作之前取了最小值
by Loser_Syx @ 2023-02-25 20:19:56