osu_rice222 @ 2024-12-12 13:57:58
#include <bits/stdc++.h>
using namespace std;
int jyh[25][25][25];
long long w(long long a,long long b,long long c){
if(a<=0||b<=0||c<=0){
return 1;
}
if(a>20||b>20||c>20){
return w(20,20,20);
}
if(jyh[a][b][c]!=0){
return jyh[a][b][c];
}
if(a<b&&b<c){
return jyh[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
}
else{
return jyh[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(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long a,b,c;
while(1){
memset(jyh,0,sizeof(jyh));
cin>>a>>b>>c;
if(a==-1&&b==-1&&c==-1){
break;
}
printf("w(%lld, %lld, %lld) = %d\n",a,b,c,w(a,b,c));
}
return 0;
}
by Noah2022 @ 2024-12-12 14:01:39
将第
by osu_rice222 @ 2024-12-12 17:53:16
@Noah2022谢谢你