30就够了,你应该是别的错误
by libohan356218 @ 2024-07-03 10:36:36
```
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define ll long long
int f[25][25][25];
int n;
ll a,b,c;
ll w(ll x,ll y,ll z)
{
if(x<=0||y<=0||z<=0) return 1;
if(x>20||y>20||z>20) return f[20][20][20]=w(20,20,20);
if(f[x][y][z]) return f[x][y][z];
if(x<y&&y<z) return f[x][y][z]=w(x,y,z-1)+w(x,y-1,z-1)-w(x,y-1,z);
else return f[x][y][z]=w(x-1,y,z)+w(x-1,y-1,z)+w(x-1,y,z-1)-w(x-1,y-1,z-1);
}
int main()
{
while(scanf("%lld%lld%lld",&a,&b,&c)!=EOF)
{
if(a==-1&&b==-1&&c==-1) return 0;
if(a<=0||b<=0||c<=0) printf("w(%lld, %lld, %lld) = 1\n",a,b,c);
else if(a>20||b>20||c>20) printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,w(20,20,20));
else printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,w(a,b,c));
}
}
```
by chenjiayicxq821411 @ 2024-07-03 10:42:37
开到四维试试
by jzm_2024 @ 2024-07-03 10:43:29
@[yjjh](/user/1036002) 不是数组的问题,
因为 a,b,c 可能为负
此时数组下标会越界
把这个 ↓
```cpp
if(ww[a][b][c]!=-1)return ww[a][b][c];
```
移到特判后就好了
by fly_x @ 2024-07-04 12:51:50
@[chenjiayicxq821411](/user/1127767) 感谢大佬,已AC,已关
by yjjh @ 2024-07-04 20:50:37