caojiaming @ 2023-01-02 12:09:10
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll func(ll a,ll b,ll c)
{
if(a<=0||b<=0||c<=0)
{
return 1;
}
else if(a>20||b>20||c>20)
{
return func(20,20,20);
}
else if(a<b&&b<c)
{
return func(a,b,c-1)+func(a-1,b-1,c)-func(a,b-1,c);
}
else
{
return func(a-1,b,c)+func(a-1,b-1,c)+func(a-1,b,c-1)-func(a-1,b-1,c-1);
}
}
int main()
{
ll a,b,c;
while(1)
{
cin>>a>>b>>c;
if(a==-1&&b==-1&&c==-1)
{
return 0;
}
cout<<"w(a, b, c) = "<<func(a, b, c)<<"\n";
}
return 0;
}
就连一分都不给呀
by caojiaming @ 2023-01-02 12:27:21
谢了
by 快速herself变换 @ 2023-01-02 12:30:18
记忆化。