結果

問題 No.162 8020運動
ユーザー らっしー(raccy)らっしー(raccy)
提出日時 2015-03-06 00:20:07
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 11,468 KB
実行使用メモリ 15,348 KB
最終ジャッジ日時 2023-09-06 15:23:52
合計ジャッジ時間 4,607 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
15,132 KB
testcase_01 AC 83 ms
15,148 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 82 ms
15,128 KB
testcase_10 AC 83 ms
15,228 KB
testcase_11 AC 82 ms
15,308 KB
testcase_12 AC 81 ms
15,036 KB
testcase_13 AC 81 ms
15,344 KB
testcase_14 AC 81 ms
15,300 KB
testcase_15 AC 81 ms
15,300 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 82 ms
15,348 KB
testcase_19 WA -
testcase_20 AC 83 ms
15,168 KB
testcase_21 AC 82 ms
15,104 KB
testcase_22 AC 98 ms
15,272 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 83 ms
15,148 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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
0