結果

問題 No.1015 おつりは要らないです
ユーザー sca1lsca1l
提出日時 2020-07-20 22:30:04
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 696 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 11,420 KB
実行使用メモリ 22,256 KB
最終ジャッジ日時 2023-08-26 02:48:56
合計ジャッジ時間 8,334 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 79 ms
15,124 KB
testcase_02 AC 77 ms
15,108 KB
testcase_03 AC 77 ms
15,124 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 78 ms
15,304 KB
testcase_07 AC 78 ms
15,280 KB
testcase_08 AC 79 ms
15,328 KB
testcase_09 AC 78 ms
15,268 KB
testcase_10 AC 151 ms
21,868 KB
testcase_11 AC 152 ms
22,004 KB
testcase_12 AC 148 ms
21,516 KB
testcase_13 AC 153 ms
21,916 KB
testcase_14 AC 152 ms
22,028 KB
testcase_15 AC 149 ms
21,788 KB
testcase_16 AC 152 ms
21,896 KB
testcase_17 AC 153 ms
22,140 KB
testcase_18 AC 151 ms
21,836 KB
testcase_19 AC 150 ms
21,848 KB
testcase_20 AC 152 ms
21,908 KB
testcase_21 AC 153 ms
21,680 KB
testcase_22 AC 153 ms
21,564 KB
testcase_23 AC 149 ms
21,644 KB
testcase_24 AC 154 ms
21,792 KB
testcase_25 AC 152 ms
21,884 KB
testcase_26 AC 150 ms
21,560 KB
testcase_27 AC 151 ms
21,524 KB
testcase_28 AC 149 ms
21,548 KB
testcase_29 AC 151 ms
21,628 KB
testcase_30 AC 78 ms
15,180 KB
testcase_31 AC 149 ms
21,420 KB
testcase_32 AC 151 ms
21,268 KB
testcase_33 AC 128 ms
22,256 KB
testcase_34 WA -
testcase_35 AC 78 ms
15,300 KB
testcase_36 AC 77 ms
15,368 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n,x,y,z = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

ans = true
a.each{|v|
  yukichi = v/10000
  yukichi = z if yukichi > z
  yukichi = 0 if yukichi < 0
  v -= yukichi*10000
  z -= yukichi
  
  higuchi = v/5000
  higuchi = y if higuchi > y
  higuchi = 0 if higuchi < 0
  v -= higuchi*5000
  y -= higuchi
  
  noguchi = v/1000
  noguchi = x if noguchi > x
  noguchi = 0 if noguchi < 0
  v -= noguchi*1000
  x -= noguchi
  
  if 0 <= v && v <1000 && x > 0
    x -= 1
    v -= 1000
  end
  if 0 <= v && v <5000 && y > 0
    y -= 1
    v -= 5000
  end
  if 0 <= v && v < 10000 && z > 0
    z -= 1
    v -= 10000
  end
  
  if v >= 0
    ans = false
    break
  end
}

puts ans ? "Yes" : "No"
0