__oio__ @ 2024-04-09 20:21:52
#include <bits/stdc++.h>
using namespace std;
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 (a < b&&b < c)
{
return (a,b,c-1) + w(a,b-1,c-1) - w(a,b-1,c);
}
else
{
return 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 (1)
{
cin>>a>>b>>c;
if(a == -1&&b == -1&&c == -1)
{
break;
}
cout<<"w("<<a<<","<<b<<","<<c<<") = "<<w(a,b,c)<<endl;
}
return 0;
}
搜索不太明白求指点?
by ycy1124 @ 2024-04-09 20:22:57
用记忆化搜索
by ycy1124 @ 2024-04-09 20:23:10
@oio
by __oio__ @ 2024-05-05 15:40:32
@ycy1124 拍一拍
by ycy1124 @ 2024-05-05 15:47:10
@oio
???啥意思
by __oio__ @ 2024-05-05 15:53:10
@ycy1124 刚看到这条然后调了亿下过了,表达感激之情
没有及时看到消息深表抱歉