为什么全部wa,111和222测试出来是标准答案的两倍,呜呜呜

P1464 Function

第一,可以把and改成&&,or改成||; 第二,第七行“<”改为“<=”
by 狂犇 @ 2019-01-03 20:50:22


那就`cout<<w(a,b,c)/2;` ~~话说我就常常这么干~~
by qwertylzx·破祥 @ 2019-01-03 21:03:13


把 < 变成 <=试试看
by 逸少 @ 2019-01-03 21:34:30


@[狂犇](/space/show?uid=125325) @[20180235陈逸凡](/space/show?uid=128775) 5个全部re了 ```cpp #include <iostream> #include<vector> #include<string> using namespace std; int k[30][30][30] ; int w(long long a, long long b, long long c) { if (a <= 0 || b <= 0 || c <= 0) return 1; if (k[a][b][c]) return k[a][b][c]; else if (a > 20 || b > 20 || c > 20) return w(20, 20, 20); else { if (a < b && b < c) k[a][b][c] = w(a, b, c - 1) + w(a, b - 1, c - 1) - w(a, b - 1, c); else k[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 k[a][b][c]; } int main() { long long a, b, c; while (1) { cin >> a >> b >> c; if (a == -1 && b == -1 && c == -1) break; else cout << "w("<<a<<", "<<b<<", "<<c<<") = "<<w(a,b,c)<< endl; } return 0; } ```
by fz风 @ 2019-01-04 11:10:55


~~数组开大点!~~ ~~尴尬~~
by 逸少 @ 2019-01-04 19:53:10


@[20180235陈逸凡](/space/show?uid=128775) 哇塞 ,开到k[99][99][99],前面两个ac了。 k【200】【200】【200】就全部ac了, 这是为什么?我看题解他们全部是25或者30了就成功了啊
by fz风 @ 2019-01-04 20:25:28


|