結果
| 問題 |
No.162 8020運動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-03-06 00:20:07 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 572 bytes |
| コンパイル時間 | 235 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-06-24 09:48:01 |
| 合計ジャッジ時間 | 3,680 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 12 WA * 14 |
コンパイルメッセージ
Syntax OK
ソースコード
a = gets.to_i
p0, p1, p2 = gets.split.map{|s|1.0 - s.to_f / 100}
list = [1.0] * 16
list[0] = 0.0
list[15] = 0.0
next_list = nil
(80 - a).times do
next_list = list.clone
(1..14).each do |i|
next_list[i] = list[i] * (p0 * (1.0 - list[i - 1]) * (1.0 - list[i + 1]) +
p1 * (1.0 - list[i - 1]) * list[i + 1] +
p1 * list[i - 1] * (1.0 - list[i + 1]) +
p2 * list[i - 1] * list[i + 1] )
end
list = next_list
end
puts list.inject{|s, p|s + p} * 2