結果
問題 | No.1015 おつりは要らないです |
ユーザー |
|
提出日時 | 2020-04-03 23:58:13 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 214 ms / 2,000 ms |
コード長 | 972 bytes |
コンパイル時間 | 301 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,740 KB |
最終ジャッジ日時 | 2024-11-17 23:18:26 |
合計ジャッジ時間 | 6,240 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import copy # 入力 N, X, Y, Z = map(int, input().split()) a = list(map(int, input().split())) a = [i // 1000 + 1 for i in a] a = sorted(a, reverse=True) # 10000円 ans = True tmp = [] for i in a: if Z > 0: if i // 10 > Z: tmp.append(i - 10 * Z) Z = 0 else: tmp.append(i % 10) Z -= i // 10 else: tmp.append(i) tmp.sort() if Z > 0: tmp = tmp[:len(tmp) - Z] a = tmp tmp = [] for i in a: if Y > 0: if i // 5 > Y: tmp.append(i - 5 * Y) Y = 0 else: tmp.append(i % 5) Y -= i // 5 else: tmp.append(i) tmp.sort() if Y > 0: tmp = tmp[:len(tmp) - Y] a = tmp tmp = [] for i in a: if X == 0 and i > 0: ans = False break if X < 0: ans = False break if X > 0: X -= i if X < 0: ans = False print('Yes' if ans else 'No')