結果
問題 |
No.398 ハーフパイプ(2)
|
ユーザー |
![]() |
提出日時 | 2016-07-14 15:53:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 332 ms / 2,000 ms |
コード長 | 1,629 bytes |
コンパイル時間 | 1,498 ms |
コンパイル使用メモリ | 168,272 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 14:22:03 |
合計ジャッジ時間 | 6,021 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { double x; cin >> x; int sum = (int)(x * 4 + 1e-9); long long ans = 0; for (int i = 0; i < 101; i++) { if (i * 4 > sum) continue; for (int j = i; j < 101; j++) { if (j * 4 < sum) continue; int lim = j - i; int limsum = sum + j - i * 5; long dp[601][4] = {0}; dp[0][0] = 1; for (int k = 0; k < 6; k++) { long next[601][4] = {0}; for (int l = 0; l <= limsum; l++) { if (lim == 0) { next[l][3] += dp[l][0] + dp[l][1] + dp[l][2] + dp[l][3]; } else { next[l][1] += dp[l][0] + dp[l][1]; next[l][3] += dp[l][2] + dp[l][3]; if (l >= lim) { next[l][2] += dp[l - lim][0] + dp[l - lim][2]; next[l][3] += dp[l - lim][1] + dp[l - lim][3]; } } for (int m = 1; m < lim && m <= l; m++) { for (int p = 0; p < 4; p++) { next[l][p] += dp[l - m][p]; } } } swap(dp, next); } ans += dp[limsum][3]; } } cout << ans << "\n"; return 0; }