結果
問題 | No.398 ハーフパイプ(2) |
ユーザー | k |
提出日時 | 2021-04-05 23:29:14 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,528 ms / 2,000 ms |
コード長 | 776 bytes |
コンパイル時間 | 2,178 ms |
コンパイル使用メモリ | 200,640 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-30 11:22:06 |
合計ジャッジ時間 | 23,644 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 493 ms
4,380 KB |
testcase_01 | AC | 1,527 ms
4,380 KB |
testcase_02 | AC | 1,005 ms
4,380 KB |
testcase_03 | AC | 1,019 ms
4,380 KB |
testcase_04 | AC | 1,009 ms
4,376 KB |
testcase_05 | AC | 1,336 ms
4,376 KB |
testcase_06 | AC | 670 ms
4,376 KB |
testcase_07 | AC | 817 ms
4,376 KB |
testcase_08 | AC | 1,528 ms
4,380 KB |
testcase_09 | AC | 1,281 ms
4,376 KB |
testcase_10 | AC | 1,304 ms
4,376 KB |
testcase_11 | AC | 1,349 ms
4,376 KB |
testcase_12 | AC | 1,194 ms
4,380 KB |
testcase_13 | AC | 1,204 ms
4,380 KB |
testcase_14 | AC | 1,175 ms
4,380 KB |
testcase_15 | AC | 1,414 ms
4,376 KB |
testcase_16 | AC | 1,198 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; long long calc(int l, int r, int sum) { if (l > r) return 0; vector<long long> dp(sum + 1); dp[0] = 1; for (int i = 0; i < 6; i++) { for (int j = sum; j >= 0; j--) { long long tmp = 0; for (int k = l; k <= r; k++) { if (j-k >= 0) tmp += dp[j-k]; } dp[j] = tmp; } } return dp[sum]; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); double x; cin >> x; int score = x * 4; long long ret = 0; for (int l = 0; l <= 100; l++) { for (int r = l; r <= 100; r++) { int sum = score + l + r; ret += calc(l, r, sum) - calc(l+1, r, sum) - calc(l, r-1, sum) + calc(l+1, r-1, sum); } } cout << ret << endl; return 0; }