把测试点下载下来本地运行是对的,但不知道为什么提交上来就 RE 了。
代码如下:
#include<bits/stdc++.h>
#define int long long
using namespace std;
int s[610][610][610];
int w(int a,int b,int c){
if(s[a+50][b+50][c+50])return s[a+50][b+50][c+50];
if(a<=0||b<=0||c<=0){return 1;}
else if(a>20||b>20||c>20)return s[a+50][b+50][c+50]=w(20,20,20);
else if(a<b&&b<c)return s[a+50][b+50][c+50]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);
else return s[a+50][b+50][c+50]=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 d,e,f;
signed main()
{
lp:
cin>>d>>e>>f;
if(d==-1&&e==-1&&f==-1)goto ls;
printf("w(%lld, %lld, %lld) = %lld\n",d,e,f,w(d,e,f));
goto lp;
ls:
return 0;
}