Liuhx7871 @ 2024-01-26 10:11:18
RE的满地都是
by wangyishan @ 2024-01-26 10:20:18
代码?
by Liuhx7871 @ 2024-01-26 12:44:25
#include<iostream>
using namespace std;
long long x[25][25][25]={};
long long w(long long a,long long b,long long c)
{
if(a<=0||b<=0||c<=0)return x[a][b][c]=1;
else if(a>20||b>20||c>20)return x[a][b][c]=w(20,20,20);
else if(x[a][b][c]!=0)return x[a][b][c];
else if(a<b&&b<c)return x[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
else return x[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()
{
long long a,b,c;
while(cin>>a>>b>>c&&a!=-1&&b!=-1&&c!=-1)
{
long long ans=w(a,b,c);
cout<<"w("<<a<<", "<<b<<", "<<c<<") ="<<ans<<endl;
}
return 0;
}