結果
問題 |
No.842 初詣
|
ユーザー |
![]() |
提出日時 | 2025-03-20 18:55:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 62,172 KB |
最終ジャッジ日時 | 2025-03-20 18:56:59 |
合計ジャッジ時間 | 1,878 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
A, B, C, D, E, F, G = map(int, input().split()) coins = [ (500, A), (100, B), (50, C), (10, D), (5, E), (1, F) ] current = {0} for value, count in coins: temp = set() for s in current: max_i = min(count, (G - s) // value) for i in range(max_i + 1): new_sum = s + value * i temp.add(new_sum) current = temp if not current: break print("YES" if G in current else "NO")