#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll s[61][61][61];
ll w(ll a,ll b,ll c){
if(a<60 && b<60 && c<60){
if(s[a][b][c]){
return s[a][b][c];
}
}
if(a<=0 or b<=0 or c<=0){
return 1;
}
if(a>20 or b>20 or c>20){
int t = w(20,20,20);
if(a<60 && b<60 && c<60) s[a][b][c] = t;
return t;
}
if(a<b && b<c){
int t = w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
if(a<60 && b<60 && c<60) s[a][b][c] = t;
return t;
}
int t = w(a-1,b,c)+w(a-1,b-1,c)+w(a-1,b,c-1)-w(a-1,b-1,c-1);
if(a<60 && b<60 && c<60) s[a][b][c] = t;
return t;
}
ll a,b,c;
int main(){
scanf("%lld%lld%lld",&a,&b,&c);
while(a!=-1 or b!=-1 or c!=-1){
printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,w(a,b,c));
scanf("%lld%lld%lld",&a,&b,&c);
}
return 0;
}
于是就RE了
求助大佬,谢谢