wrong answer Too long on line 9/45?

P1464 Function

别开完全隐私保护谢谢
by 小粉兔 @ 2018-11-17 22:51:02


别开完全隐私保护谢谢。
by 用户已注销 @ 2018-11-17 22:53:16


应该~~活该吧~~
by goodlearndaydayup @ 2018-11-17 22:55:02


```cpp #include <bits/stdc++.h> #define LL long long #define f_mark f[a][b][c] == -1 #define mark a != -1 || b != -1 || c != -1 using namespace std; LL a, b, c, f[25][25][25]; LL dfs( LL a, LL b, LL c ) { if ( a > 20 || b > 20 || c > 20 ) return(dfs( 20, 20, 20 ) ); if ( a < 1 || b < 1 || c < 1 ) return(1); if ( a < b && b < c && f_mark ) f[a][b][c] = dfs( a, b, c - 1 ) + dfs( a, b - 1, c - 1 ) - dfs( a, b - 1, c ); else if ( f_mark ) f[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 ); return(f[a][b][c]); } int main() { memset( f, -1, sizeof(f) ); do { scanf( "%lld%lld%lld", &a, &b, &c ); LL ans = dfs( a, b, c ); if ( mark ) printf( "w(%lld, %lld, %lld) = %lld\n", a, b, c, ans ); } while ( mark ); return(0); } ```
by Smoggy @ 2018-11-17 23:01:13


@[小粉兔](/space/show?uid=10703) @[fzszkl](/space/show?uid=23323) ~~**@违规用户名XRSq*3EK**~~
by Smoggy @ 2018-11-17 23:02:27


仔细读题啊。。。 ``` if ( a > 20 || b > 20 || c > 20 ) return(dfs( 20, 20, 20 ) ); if ( a < 1 || b < 1 || c < 1 ) return(1); ``` 这两步应当反过来,就可以通过这道(橙)题了。 建议加入“代码公开计划”。
by 用户已注销 @ 2018-11-18 13:45:32


都是大佬
by wsnb6666 @ 2018-12-08 21:40:41


@[fzszkl](/space/show?uid=23323) 已过,thx。 ~~我太蒟了~~
by Smoggy @ 2018-12-17 13:41:47


~~可你还没加入代码公开~~
by 用户已注销 @ 2018-12-18 15:16:26


|