結果

問題 No.32 貯金箱の憂鬱
ユーザー nckkhtnckkht
提出日時 2017-01-14 15:12:33
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 923 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 7,908 KB
最終ジャッジ日時 2023-09-30 08:21:23
合計ジャッジ時間 997 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,872 KB
testcase_01 AC 16 ms
7,804 KB
testcase_02 AC 15 ms
7,788 KB
testcase_03 AC 15 ms
7,780 KB
testcase_04 AC 16 ms
7,788 KB
testcase_05 AC 15 ms
7,820 KB
testcase_06 AC 16 ms
7,756 KB
testcase_07 AC 16 ms
7,908 KB
testcase_08 AC 16 ms
7,840 KB
testcase_09 AC 16 ms
7,840 KB
testcase_10 AC 18 ms
7,872 KB
testcase_11 AC 16 ms
7,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K = 0 #1000円札の枚数
L = int(input()) #100円硬貨の枚数
M = int(input()) #25円硬貨の枚数
N = int(input()) #1円硬貨の枚数

#x 両替対象の硬貨
#y 両替後対象の硬貨/紙幣
#z1 両替前の硬貨の金額
#z2 両替後の硬貨/紙幣の金額
def Exchange(x,y,z1,z2):
    if (x * z1) % z2 == 0:
        return 0, int(y + x // (z2 / z1))
    else:
        return int(x % (z2 / z1)), int(y + x // (z2 / z1))

if N < 25:
    if M >= 4:
        M, L = Exchange(M, L, 25, 100)
        if L >=10:
            L, K = Exchange(L, K, 100, 1000)
    else:
        if L >=10:
            L, K = Exchange(L, K, 100, 1000)
elif 25 <= N <= 1000:
    N, M = Exchange(N, M, 1, 25)
    if M >= 4:
        M, L = Exchange(M, L, 25, 100)
        if 10 <= L:
            L, K = Exchange(L, K, 100, 1000)
    else:
        if 10 <= L:
            L, K = Exchange(L, K, 100, 1000)
else:
    pass
print(L + M + N)
0