求助大佬帮忙
by jiezecheng @ 2024-09-08 11:55:46
一年前的代码,已经忘了怎么写的了
```cpp
#include<cstdio>
#include<cstring>
#define llx long long
using namespace std;
llx f[40][40][40],a,b,c;
llx fun(llx x,llx y,llx z){
if(x<=20&&y<=20&&z<=20&&x>=0&&y>=0&&z>=0)if(f[x][y][z]){return f[x][y][z];}
if((x<=0)||(y<=0)||(z<=0)){return 1;}
if((x>20)||(y>20)||(z>20)){return fun(20,20,20);}
if((x<y)&&(y<z)){return f[x][y][z]=fun(x,y,z-1)+fun(x,y-1,z-1)-fun(x,y-1,z);}
return f[x][y][z]=fun(x-1,y,z)+fun(x-1,y-1,z)+fun(x-1,y,z-1)-fun(x-1,y-1,z-1);
}
void out(){
printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,fun(a,b,c));
}
int main(){
while(1){
scanf("%lld%lld%lld",&a,&b,&c);
if((a==-1)&&(b==-1)&&(c==-1)){
break;
}
out();
}
return 0;
}
```
求关
by kaiweiwang @ 2024-09-08 12:02:58
建议O3启动?
by liujinxv123 @ 2024-09-08 12:26:00
```int ans[25][25][25]```
改成
```long long ans[25][25][25]```
by mahaorui2012 @ 2024-09-15 16:21:24
@[mahaorui2012](/user/923953) 好了,谢谢
by jiezecheng @ 2024-09-21 08:28:43
加一个
```cpp
#define int long long
```
就行了
by XY_guiling_ @ 2024-10-12 20:05:59