测试点2段错误RE

P1464 Function

@[akl123](/user/1057681) 很简单,数组开小了
by rnf5114 @ 2023-08-12 21:36:25


顺带附上递归代码 ```cpp #include <iostream> using namespace std; long long d[600][600][600]; int dfs(long long a,long long b,long long c){ if(a<=0||b<=0||c<=0){ return 1; } else if(a>20||b>20||c>20){ return dfs(20,20,20); } else if(a<b&&b<c){ if(d[a][b][c-1]==0) d[a][b][c-1]=dfs(a,b,c-1); if(d[a][b-1][c-1]==0) d[a][b-1][c-1]=dfs(a,b-1,c-1); if(d[a][b-1][c]==0) d[a][b-1][c]=dfs(a,b-1,c); return d[a][b][c-1]+d[a][b-1][c-1]-d[a][b-1][c]; } else{ if(d[a-1][b][c]==0) d[a-1][b][c]=dfs(a-1,b,c); if(d[a-1][b-1][c]==0) d[a-1][b-1][c]=dfs(a-1,b-1,c); if(d[a-1][b][c-1]==0) d[a-1][b][c-1]=dfs(a-1,b,c-1); if(d[a-1][b-1][c-1]==0) d[a-1][b-1][c-1]=dfs(a-1,b-1,c-1); return d[a-1][b][c]+d[a-1][b-1][c]+d[a-1][b][c-1]-d[a-1][b-1][c-1]; } } int main(){ long long a,b,c; while(1){ cin>>a>>b>>c; if(a==-1&&b==-1&&c==-1){ return 0; } cout<<"w("<<a<<", "<<b<<", "<<c<<") = "<<dfs(a,b,c)<<endl; } return 0; } /* ┏┓   ┏┓ ┏┛┻━━━┛┻┓ ┃       ┃ ┃   ━   ┃ ┃ ┳┛ ┗┳ ┃ ┃       ┃ ┃   ┻   ┃ ┃       ┃ ┗━┓   ┏━┛Codes are far away from bugs with the animal protecting ┃   ┃ 神兽保佑,代码无bug ┃   ┃ ┃   ┗━━━┓ ┃      ┣┓ ┃     ┏┛ ┗┓┓┏━┳┓┏┛ ┃┫┫ ┃┫┫ ┗┻┛ ┗┻┛ */ ```
by rnf5114 @ 2023-08-12 21:38:04


@[rnfmabj5114](/user/917683) 感谢!!!
by akl123 @ 2023-08-12 21:41:17


|