#是 [RE了](http://www.luogu.org/record/show?rid=852261)
by CraZYali @ 2016-08-09 13:09:29
是不是越界了??
by Deny_小田 @ 2016-08-09 13:12:32
@[chenziyang](/space/show?uid=18215) if(pd[a][b][c]==1)return ans[a][b][c];把这句放到后两句后面
by doby @ 2016-08-09 13:53:34
#\_[WA了](http://www.luogu.org/problem/show?pid=1464#sub)\_
by CraZYali @ 2016-08-09 14:29:34
@doby
by CraZYali @ 2016-08-09 15:15:23
```cpp
@[chenziyang](/space/show?uid=18215)
#include<iostream>
#include<string>
using namespace std;
long long i,m,n,j,k;
long long ans[21][21][21],pd[21][21][21];
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(pd[a][b][c]==1)return ans[a][b][c];
if(a<b && b<c){
pd[a][b][c]=1;
ans[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
return ans[a][b][c];
}
pd[a][b][c]=1;
ans[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 ans[a][b][c];
}
int main(){
while(cin>>i>>m>>k && (i!=-1||m!=-1||k!=-1))
cout<<"w("<<i<<", "<<m<<", "<<k<<") = "<<w(i,m,k)<<endl;
return 0;
}
```
by 老K @ 2016-08-09 16:30:48
@chenziyang
by 老K @ 2016-08-09 16:31:46
@[chenziyang](http://www.luogu.org/space/show?uid=18215)
by 老K @ 2016-08-09 16:33:14
关键在输入的这个地方:
while(cin>>i>>m>>k && (i!=-1||m!=-1||k!=-1))
cout<<"w("<<i<<", "<<m<<", "<<k<<") = "<<w(i,m,k)<<endl;
by 老K @ 2016-08-09 16:33:49
因为i==-1 但m,k!=-1也要计算
by 老K @ 2016-08-09 16:34:36