我也觉得不用清零
by turTLE_Null @ 2019-10-21 19:47:24
不用清零
by opened @ 2019-10-21 19:49:31
```
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
ll dp[30][30][30];
ll f(ll a,ll b,ll c){
if(a<=0||b<=0||c<=0) return 1;
if(a>20||b>20||c>20) return f(20,20,20);
if(dp[a][b][c]) return dp[a][b][c];
if(a<b&&b<c) dp[a][b][c]=f(a,b,c-1)+f(a,b-1,c-1)-f(a,b-1,c);
else dp[a][b][c]=f(a-1,b,c)+f(a-1,b-1,c)+f(a-1,b,c-1)-f(a-1,b-1,c-1);
return dp[a][b][c];
}
int main(){
ll a,b,c;
while(cin>>a>>b>>c&&!(a==-1&&b==-1&&c==-1)) printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,f(a,b,c));
return 0;
}
```
by opened @ 2019-10-21 19:50:39
@[opened](/space/show?uid=90615) 可是好像答案会错,不清的话
by wtk09300033 @ 2019-10-30 18:39:23