C++ 没见过的编译失败方式

P1464 Function

@[CoCo_Candy](/user/337878) 我太弱了[哭]
by HC_Lin @ 2022-08-27 17:00:40


@[HC_Lin](/user/730477) 你忘了return 0了吧
by gmy_coding @ 2022-10-12 21:02:45


`你空间复杂度爆了!` ```cpp #include <bits/stdc++.h> using namespace std; long long f[25][25][25]; long long w(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 w(20,20,20); else if(f[a][b][c]!=0) return f[a][b][c]; 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(cin>>a>>b>>c) { if(a==-1&&b==-1&&c==-1) break; cout<<"w("<<a<<", "<<b<<", "<<c<<") = "<<w(a,b,c)<<endl; } return 0; } ```
by int_stl @ 2022-11-16 14:38:19


上一页 |