HuangHongrui @ 2024-03-10 09:36:09
帮帮我,大佬先生
#include<bits/stdc++.h>
using namespace std;
long long s[25][25][25];
bool ch[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(ch[a][b][c]==true) return s[a][b][c];
if(a<b&&b<c)
{
s[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
ch[a][b][c]=true;
return s[a][b][c];
}
s[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);
ch[a][b][c]=true;
return s[a][b][c];
}
int main()
{
long long a,b,c;
while(cin>>a>>b>>c)
{
if(a==b&&b==c&&a==-1) return 0;
printf("w(%d, %d, %d) = %d\n",a,b,c,w(a,b,c));
}
return 0;
}
by Mr_Az @ 2024-03-10 09:37:42
%lld
by zhangxiaoxuan @ 2024-03-23 15:25:55
@HuangHongrui