lrmlrm_ @ 2023-06-05 12:57:50
评测
把测试点下载下来本地运行是对的,但不知道为什么提交上来就 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;
}
by technopolis_2085 @ 2023-06-05 13:29:35
看数据范围。
by zwy__ @ 2023-06-05 13:31:02
@past_tense 题目里的数只要大于20就返回20
by MiPloRAs_3316 @ 2023-06-05 13:32:24
数据长这个样子
2147483648 1 1
-1 -1 -1
显而易见的,
by _Cheems @ 2023-06-05 13:34:25
@Brown_Sugar %%%
by technopolis_2085 @ 2023-06-05 13:35:46
@jzjwsyps_ 我知道,但是代码中
else if(a>20||b>20||c>20)return s[a+50][b+50][c+50]=w(20,20,20);
这一行,当
by zwy__ @ 2023-06-05 13:36:56
@past_tense 懂啦
by MiPloRAs_3316 @ 2023-06-05 13:38:47
@gyss 其实就是数组访问越界导致的RE
by lrmlrm_ @ 2023-06-05 13:39:54
thx
by oldsix_2 @ 2023-06-12 21:15:58
不开longlong见祖宗
by Liuzhenyuan @ 2023-06-14 19:28:17
的确,@oldsix_2说得对