提出 #21906538


ソースコード 拡げる

def main():
    n = int(input())
    a, b, c = map(int, input().split())
    ans = 10000
    for i in range(10000):
        for j in range(10000):
            value = i * a + j * b
            if n < value or (n - value) % c != 0:
                continue
            res = i + j + (n - value) // c
            if ans > res:
                ans = res
    print(ans)

if __name__ == "__main__":
    main()

提出情報

提出日時
問題 016 - Minimum Coins(★3)
ユーザ kichi2004_
言語 PyPy3 (7.3.0)
得点 3
コード長 421 Byte
結果 AC
実行時間 1467 ms
メモリ 67892 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 3 / 3
結果
AC × 4
AC × 21
セット名 テストケース
Sample sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt
All rand_01.txt, rand_02.txt, rand_03.txt, rand_04.txt, rand_05.txt, rand_06.txt, rand_07.txt, rand_08.txt, rand_09.txt, rand_10.txt, rand_large_abc_1.txt, rand_large_abc_2.txt, rand_large_abc_3.txt, sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt, small_1.txt, small_2.txt, small_3.txt, small_4.txt
ケース名 結果 実行時間 メモリ
rand_01.txt AC 977 ms 67500 KiB
rand_02.txt AC 939 ms 67688 KiB
rand_03.txt AC 1089 ms 67720 KiB
rand_04.txt AC 961 ms 67444 KiB
rand_05.txt AC 960 ms 67728 KiB
rand_06.txt AC 948 ms 67532 KiB
rand_07.txt AC 1076 ms 67472 KiB
rand_08.txt AC 1102 ms 67892 KiB
rand_09.txt AC 958 ms 67704 KiB
rand_10.txt AC 1098 ms 67584 KiB
rand_large_abc_1.txt AC 249 ms 67620 KiB
rand_large_abc_2.txt AC 651 ms 67328 KiB
rand_large_abc_3.txt AC 1467 ms 65180 KiB
sample_1.txt AC 250 ms 65280 KiB
sample_2.txt AC 750 ms 67820 KiB
sample_3.txt AC 701 ms 67512 KiB
sample_4.txt AC 1063 ms 67748 KiB
small_1.txt AC 1371 ms 67740 KiB
small_2.txt AC 246 ms 64940 KiB
small_3.txt AC 232 ms 64924 KiB
small_4.txt AC 233 ms 64888 KiB