全部WA求助!

P1464 Function

RE非WA也。。。
by MvemiY @ 2022-06-30 19:21:43


有几次是WA
by lizhehao2009 @ 2022-06-30 19:23:03


@[Birdly](/user/620253) 所以您知道我的代码错在何处吗?
by lizhehao2009 @ 2022-06-30 19:23:49


@[lizhehao2009](/user/727871) 你先把那些特判更改abc的值的代码去掉看看还RE吗
by MvemiY @ 2022-06-30 19:24:48


@[Birdly](/user/620253) 还是RE
by lizhehao2009 @ 2022-06-30 19:26:22


先把if都变成else if,首先就不RE了
by MvemiY @ 2022-06-30 19:27:52


值w函数内
by MvemiY @ 2022-06-30 19:28:24


@[Birdly](/user/620253) 似乎不行 ```cpp #include<bits/stdc++.h> using namespace std; long long f[30][30][30]; long long w(int a,int b,int c) { if (a<=0||b<=0||c<=0) { return 1; } else if (f[a][b][c]>0) { return f[a][b][c]; } else if (a>20||b>20||c>20) { f[a][b][c]=w(20,20,20); } else if (a<b&&b<c) { f[a][b][c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c); } else { f[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 f[a][b][c]; } int main() { long long a,b,c; while (1) { cin>>a>>b>>c; memset(f,0,sizeof(f)); if (a==-1&&b==-1&&c==-1) { return 0; } cout<<"w("<<a<<", "<<b<<", "<<c<<") = "<<w(a,b,c)<<endl; } return 0; } ```
by lizhehao2009 @ 2022-06-30 19:29:37


应该是爆栈了,可是。。。(容蒟蒻思考思考
by MvemiY @ 2022-06-30 19:33:53


@[Birdly](/user/620253) 不知爆栈是什么意思?
by lizhehao2009 @ 2022-06-30 19:35:14


| 下一页