結果

問題 No.555 世界史のレポート
ユーザー sue_charosue_charo
提出日時 2017-08-11 23:33:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 888 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-04-20 23:44:34
合計ジャッジ時間 2,085 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 28 ms
10,624 KB
testcase_02 AC 28 ms
10,624 KB
testcase_03 AC 35 ms
10,880 KB
testcase_04 AC 37 ms
10,752 KB
testcase_05 AC 44 ms
10,752 KB
testcase_06 AC 47 ms
10,752 KB
testcase_07 AC 51 ms
10,880 KB
testcase_08 AC 58 ms
11,008 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    N = II()
    C, V = ILI()
    return N, C, V


def do_copy_paste(now_length, now_cost, now_clip, N, C, V):
    if now_length >= N:
        return now_cost
    if now_clip == 0:
        copy = do_copy_paste(now_length, now_cost + C, now_length, N, C, V)
        return copy
    if now_length == now_clip:
        paste = do_copy_paste(now_length + now_clip, now_cost + V, now_clip, N, C, V)
        return paste

    copy = do_copy_paste(now_length, now_cost + C, now_length, N, C, V)
    paste = do_copy_paste(now_length + now_clip, now_cost + V, now_clip, N, C, V)

    return min(copy, paste)


def solve(N, C, V):
    ans = do_copy_paste(1, 0, 0, N, C, V)
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()
0