結果

問題 No.555 世界史のレポート
ユーザー sue_charosue_charo
提出日時 2017-08-11 23:36:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 931 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,544 KB
最終ジャッジ日時 2024-04-20 23:46:59
合計ジャッジ時間 4,311 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
16,384 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 31 ms
10,624 KB
testcase_03 AC 38 ms
10,880 KB
testcase_04 AC 41 ms
10,880 KB
testcase_05 AC 46 ms
11,008 KB
testcase_06 AC 50 ms
10,880 KB
testcase_07 AC 55 ms
11,008 KB
testcase_08 AC 62 ms
10,880 KB
testcase_09 AC 69 ms
11,008 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
import sys
sys.setrecursionlimit(10 ** 6)

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