結果

問題 No.32 貯金箱の憂鬱
ユーザー nckkhtnckkht
提出日時 2017-01-14 15:09:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 958 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 7,992 KB
最終ジャッジ日時 2023-08-23 10:35:21
合計ジャッジ時間 973 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,888 KB
testcase_01 AC 16 ms
7,792 KB
testcase_02 AC 16 ms
7,888 KB
testcase_03 AC 17 ms
7,776 KB
testcase_04 AC 17 ms
7,852 KB
testcase_05 AC 16 ms
7,796 KB
testcase_06 AC 16 ms
7,816 KB
testcase_07 AC 16 ms
7,816 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 16 ms
7,892 KB
testcase_11 AC 16 ms
7,904 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 10 <= L <= 1000:
            L, K = Exchange(L, K, 100, 1000)
    else:
        if 10 <= L <= 1000:
            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 <= 1000:
            L, K = Exchange(L, K, 100, 1000)
    else:
        if 10 <= L <= 1000:
            L, K = Exchange(L, K, 100, 1000)
else:
    pass
print(L + M + N)
0