結果

問題 No.1015 おつりは要らないです
ユーザー ryosuke0825ryosuke0825
提出日時 2020-04-03 21:55:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,164 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 19,440 KB
最終ジャッジ日時 2023-09-16 01:16:24
合計ジャッジ時間 5,812 ms
ジャッジサーバーID
(参考情報)
judge12 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,408 KB
testcase_01 AC 16 ms
8,272 KB
testcase_02 AC 17 ms
8,440 KB
testcase_03 AC 17 ms
8,268 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
8,304 KB
testcase_08 AC 17 ms
8,292 KB
testcase_09 AC 15 ms
8,228 KB
testcase_10 AC 175 ms
18,872 KB
testcase_11 AC 183 ms
18,856 KB
testcase_12 AC 173 ms
18,348 KB
testcase_13 AC 179 ms
18,688 KB
testcase_14 AC 183 ms
19,440 KB
testcase_15 AC 174 ms
18,436 KB
testcase_16 AC 183 ms
18,828 KB
testcase_17 AC 182 ms
19,164 KB
testcase_18 AC 180 ms
18,804 KB
testcase_19 AC 186 ms
18,820 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 16 ms
8,336 KB
testcase_31 AC 103 ms
10,268 KB
testcase_32 AC 103 ms
10,224 KB
testcase_33 AC 61 ms
18,972 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 17 ms
8,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
N, X, Y, Z = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
for a in A:
    # 1万円以上なら
    if a >= 10001:
        if a <= 10000*Z:
            Z -= a // 10000
            a -= (a // 10000)*10000
        else:
            a -= 10000*Z
            Z = 0

    # 5千円以上なら
    if a >= 5001:
        if a <= 5000*Y:
            Y -= a // 5000
            a -= (a // 5000)*5000
        else:
            a -= 5000*Y
            Y = 0

    # 千円で払えるだけ払う
    if a > 0:
        if a < 1000*X:
            X -= a // 1000+1
            a -= (a // 1000 + 1) * 1000
        else:
            a -= 1000*X
            X = 0

    # 千円が不足しているなら5千円で払う
    if a > 0:
        if a < 5000*Y:
            Y -= a // 5000+1
            a -= (a // 5000 + 1) * 5000
        else:
            a -= 5000*Y
            Y = 0

    # 千円と5千円が不足しているなら1万円で払う
    if a > 0:
        if a < 10000*Z:
            Z -= a // 10000+1
            a -= (a // 10000 + 1) * 10000
        else:
            print('No')
            exit(0)
print('Yes')
0