結果
| 問題 |
No.842 初詣
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-04 08:43:49 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 572 bytes |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-09-14 23:36:54 |
| 合計ジャッジ時間 | 2,924 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 7 |
コンパイルメッセージ
Syntax OK
ソースコード
$rates = [5, 2, 5, 2, 5]
$values = [500, 100, 50, 10, 5]
def normalize cs
5.times {|i|
cs[4 - i] += cs[5 - i] / $rates[4 - i]
cs[5 - i] %= $rates[4 - i]
}
cs
end
def is_possible cs, t
5.times {|i|
return false if cs[i] < t / $values[i]
cs[i] -= t / $values[i]
t %= $values[i]
}
r = $values.zip(cs).collect {|s|
s[0] * s[1]
}.sum + cs[5]
return false if r < t
true
end
a, b, c, d, e, f, g = gets.chomp.split.map &:to_i
puts (is_possible(normalize([a, b, c, d, e, f]), g)) ? "YES" : "NO"