全部RE,求助!!

P1464 Function

考虑输入 `50 50 50`。
by ud2_ @ 2021-09-26 21:38:59


这样还是不对 ```cpp #include<bits/stdc++.h> using namespace std; long long w[50][50][50]; long long 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(w[a][b][c]!=-1) { return w[a][b][c]; } else { if(a<b&&b<c) { w[a][b][c]=dfs(a,b,c-1)+dfs(a,b-1,c-1)-dfs(a,b-1,c); } else { w[a][b][c]=dfs(a-1,b,c)+dfs(a-1,b-1,c)+dfs(a-1,b,c-1)-dfs(a-1,b-1,c-1); } } } signed main() { memset(w,-1,sizeof(w)); long long a,b,c; cin>>a>>b>>c; do { dfs(a,b,c); printf("w(%lld, %lld, %lld) = %lld\n",a,b,c,w[a][b][c]); cin>>a>>b>>c; } while(a!=-1||b!=-1||c!=-1); } ```
by Li_wenjie @ 2021-09-26 21:45:06


```plain main.cpp: In function 'long long int dfs(long long int, long long int, long long int)': main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type] 30 | } | ^ ``` 编译器说你忘 `return` 了。
by ud2_ @ 2021-09-26 21:48:36


|