結果

問題 No.842 初詣
ユーザー pekempeypekempey
提出日時 2019-06-28 21:25:53
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 202 bytes
コンパイル時間 55 ms
コンパイル使用メモリ 11,584 KB
実行使用メモリ 15,364 KB
最終ジャッジ日時 2023-09-14 21:34:24
合計ジャッジ時間 2,800 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,136 KB
testcase_01 AC 80 ms
15,184 KB
testcase_02 AC 80 ms
15,088 KB
testcase_03 AC 78 ms
15,128 KB
testcase_04 AC 80 ms
15,164 KB
testcase_05 AC 83 ms
15,164 KB
testcase_06 AC 79 ms
15,052 KB
testcase_07 AC 80 ms
15,164 KB
testcase_08 AC 80 ms
15,156 KB
testcase_09 AC 80 ms
15,048 KB
testcase_10 AC 81 ms
15,364 KB
testcase_11 AC 80 ms
15,088 KB
testcase_12 AC 81 ms
15,324 KB
testcase_13 AC 80 ms
15,276 KB
testcase_14 AC 80 ms
15,296 KB
testcase_15 AC 79 ms
15,048 KB
testcase_16 AC 80 ms
15,052 KB
testcase_17 AC 80 ms
15,160 KB
testcase_18 AC 80 ms
15,240 KB
testcase_19 AC 81 ms
15,048 KB
testcase_20 AC 80 ms
15,188 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a = gets.split.map(&:to_i)
coin = [500, 100, 50, 10, 5, 1]
s = a[6]
6.times do |i|
  while s >= coin[i] && a[i] > 0
    s -= coin[i]
    a[i] -= 1
  end
end

if s == 0
  puts "YES"
else
  puts "NO"
end
0