1.这是有规律的
2.可以记搜
贴上我的
```cpp
#include <bits/stdc++.h>
using namespace std;
long long f[21][21][21];//记忆化
long long w(int a, int b, int c)
{
if (a <= 0 || b <= 0 || c <= 0)
return 1;
if (a > 20 || b > 20 || c > 20)
return w(20, 20 , 20);
if (f[a][b][c] == 0)
{
if (a < b && b < c)
f[a][b][c] = w(a, b, c - 1) + w(a, b-1, c-1)-w(a, b-1, c);
else
f[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);
return f[a][b][c];
}
}
int main()
{
long long a, b, c;
while (1)
{
scanf ("%lld %lld %lld", &a, &b, &c);
if (a == -1 && b == -1 && c == -1)
break;
printf ("w(%lld, %lld, %lld) = %lld\n", a, b, c, w(a, b, c));
}
}
```
by tocek_shiki @ 2018-08-27 22:46:44
非常感谢@[fff团666](/space/show?uid=49562)
by tdn去世号 @ 2018-08-27 23:01:17