結果
問題 | No.842 初詣 |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:15:51 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 82,580 KB |
実行使用メモリ | 61,624 KB |
最終ジャッジ日時 | 2025-03-20 21:16:36 |
合計ジャッジ時間 | 1,913 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 * itemp.add(new_sum)current = tempif not current:breakprint("YES" if G in current else "NO")