結果

問題 No.1501 酔歩
ユーザー kotatsugamekotatsugame
提出日時 2021-05-07 23:04:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 638 ms / 2,000 ms
コード長 255 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 11,500 KB
実行使用メモリ 40,616 KB
最終ジャッジ日時 2023-10-13 14:23:34
合計ジャッジ時間 24,501 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,104 KB
testcase_01 AC 79 ms
15,104 KB
testcase_02 AC 80 ms
15,144 KB
testcase_03 AC 79 ms
15,000 KB
testcase_04 AC 82 ms
15,144 KB
testcase_05 AC 555 ms
33,648 KB
testcase_06 AC 423 ms
30,956 KB
testcase_07 AC 522 ms
32,756 KB
testcase_08 AC 172 ms
19,268 KB
testcase_09 AC 445 ms
32,024 KB
testcase_10 AC 222 ms
21,644 KB
testcase_11 AC 410 ms
30,740 KB
testcase_12 AC 321 ms
25,268 KB
testcase_13 AC 80 ms
15,048 KB
testcase_14 AC 80 ms
15,088 KB
testcase_15 AC 80 ms
15,240 KB
testcase_16 AC 81 ms
15,220 KB
testcase_17 AC 81 ms
15,056 KB
testcase_18 AC 80 ms
15,088 KB
testcase_19 AC 79 ms
15,144 KB
testcase_20 AC 82 ms
15,088 KB
testcase_21 AC 81 ms
15,220 KB
testcase_22 AC 635 ms
40,580 KB
testcase_23 AC 627 ms
40,412 KB
testcase_24 AC 630 ms
40,600 KB
testcase_25 AC 627 ms
40,304 KB
testcase_26 AC 638 ms
40,460 KB
testcase_27 AC 635 ms
40,448 KB
testcase_28 AC 634 ms
40,316 KB
testcase_29 AC 638 ms
40,528 KB
testcase_30 AC 633 ms
40,384 KB
testcase_31 AC 635 ms
40,516 KB
testcase_32 AC 632 ms
40,272 KB
testcase_33 AC 634 ms
40,392 KB
testcase_34 AC 630 ms
40,392 KB
testcase_35 AC 631 ms
40,616 KB
testcase_36 AC 636 ms
40,420 KB
testcase_37 AC 633 ms
40,436 KB
testcase_38 AC 636 ms
40,532 KB
testcase_39 AC 635 ms
40,360 KB
testcase_40 AC 633 ms
40,392 KB
testcase_41 AC 633 ms
40,532 KB
testcase_42 AC 534 ms
40,600 KB
testcase_43 AC 79 ms
15,128 KB
testcase_44 AC 80 ms
15,056 KB
testcase_45 AC 512 ms
40,400 KB
testcase_46 AC 518 ms
40,404 KB
testcase_47 AC 509 ms
40,600 KB
testcase_48 AC 552 ms
40,560 KB
testcase_49 AC 549 ms
40,496 KB
testcase_50 AC 560 ms
40,440 KB
testcase_51 AC 553 ms
40,480 KB
testcase_52 AC 551 ms
40,572 KB
testcase_53 AC 80 ms
15,240 KB
testcase_54 AC 83 ms
15,096 KB
testcase_55 AC 81 ms
15,008 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,k=gets.split.map &:to_i
a=gets.split.map &:to_r
x=[[0r,0r]]
1.upto(n-2){|i|
  s=a[i-1]+a[i+1]
  l=a[i-1]/s
  b=1-l*x[-1][1]
  x<<[l*x[-1][0]/b,a[i+1]/s/b]
}
y=[]
y[n-1]=1r
(n-2).downto(0){|i|y[i]=x[i][0]+x[i][1]*y[i+1]}
ans=y[k-1]
puts ans==0r ? 0 : ans
0