結果

問題 No.740 幻の木
ユーザー lloyzlloyz
提出日時 2022-05-30 23:19:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 11,852 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2023-10-21 00:24:53
合計ジャッジ時間 1,043 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,112 KB
testcase_01 AC 29 ms
10,112 KB
testcase_02 AC 26 ms
10,112 KB
testcase_03 AC 27 ms
10,112 KB
testcase_04 AC 27 ms
10,112 KB
testcase_05 AC 31 ms
10,112 KB
testcase_06 AC 27 ms
10,112 KB
testcase_07 AC 26 ms
10,112 KB
testcase_08 AC 26 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left

n, m, p, q = map(int, input().split())

DP = [0 for _ in range(12)]
if p == 1:
    DP[0] = 2 * m
else:
    DP[0] = m
for i in range(1, 12):
    if p - 1 <= i < p + q - 1:
        DP[i] += DP[i - 1] + 2 * m
    else:
        DP[i] += DP[i - 1] + m
tot = DP[-1]
r, q = divmod(n, tot)
idx = bisect_left(DP, q)
print(12 * r + idx + 1)
0