gzwm @ 2023-10-25 20:45:08
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll sw[25][25][25];
ll f(ll a,ll b,ll c){
if(a<=0||b<=0||c<=0)
return 1;
if(a>20||b>20||c>20)
return f(20,20,20);
if(sw[a][b][c]!=0)
return sw[a][b][c];
if(a<b&&b>c)
return sw[a][b][c]=f(a,b,c-1)+f(a,b-1,c-1)-f(a,b-1,c);
return sw[a][b][c]=f(a-1,b,c)+f(a-1,b-1,c)+f(a-1,b,c-1)-f(a-1,b-1,c-1);
}
int main(){
while(1){
ll a,b,c;
cin>>a>>b>>c;
if(a==-1&&b==-1&&c==-1)
break;
else
printf("w(%lld,%lld,%lld) = %lld\n",a,b,c,f(a,b,c));
}
return 0;
}
by CooooldWind_ @ 2023-10-25 20:55:46
样例都没过的屑