結果

問題 No.1501 酔歩
ユーザー そすうぽよそすうぽよ
提出日時 2021-05-07 22:45:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 139,528 KB
最終ジャッジ日時 2023-10-13 14:04:36
合計ジャッジ時間 26,862 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 206 ms
89,192 KB
testcase_01 AC 203 ms
88,976 KB
testcase_02 AC 205 ms
89,032 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 614 ms
129,040 KB
testcase_06 AC 463 ms
119,528 KB
testcase_07 AC 511 ms
126,380 KB
testcase_08 AC 325 ms
96,584 KB
testcase_09 AC 482 ms
122,880 KB
testcase_10 AC 351 ms
100,652 KB
testcase_11 AC 455 ms
118,120 KB
testcase_12 AC 428 ms
109,948 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 610 ms
139,024 KB
testcase_23 AC 594 ms
139,084 KB
testcase_24 AC 593 ms
139,128 KB
testcase_25 AC 586 ms
138,952 KB
testcase_26 AC 606 ms
139,040 KB
testcase_27 AC 600 ms
139,024 KB
testcase_28 AC 588 ms
138,816 KB
testcase_29 AC 593 ms
139,052 KB
testcase_30 AC 577 ms
139,032 KB
testcase_31 AC 569 ms
138,968 KB
testcase_32 AC 585 ms
138,924 KB
testcase_33 AC 621 ms
139,036 KB
testcase_34 AC 570 ms
139,168 KB
testcase_35 AC 590 ms
139,084 KB
testcase_36 AC 615 ms
139,172 KB
testcase_37 AC 585 ms
139,064 KB
testcase_38 AC 584 ms
138,840 KB
testcase_39 AC 588 ms
139,072 KB
testcase_40 AC 584 ms
139,020 KB
testcase_41 AC 582 ms
138,976 KB
testcase_42 AC 508 ms
139,240 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 500 ms
139,200 KB
testcase_46 AC 499 ms
139,236 KB
testcase_47 AC 511 ms
138,980 KB
testcase_48 AC 519 ms
139,528 KB
testcase_49 AC 546 ms
138,980 KB
testcase_50 AC 533 ms
139,224 KB
testcase_51 AC 522 ms
139,116 KB
testcase_52 AC 531 ms
139,344 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 210 ms
88,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction
n,k = map(int, input().split())
a = list(map(int, input().split()))
x1 = [Fraction(0, 1)]
x0 = [Fraction(0, 1)]
for i in range(1, n-1):
    y = Fraction(a[i-1], a[i-1] + a[i+1])
    z = Fraction(a[i+1], a[i-1] + a[i+1])
    nxd = Fraction(1) - y * x1[-1]
    x1.append(z / nxd)
    x0.append(y * x0[-1] / nxd)

p = [Fraction(0) for _i in range(n)]
p[-1] = 1

for ri in range(1, n-1):
    i = n - 1 - ri
    p[i] = x1[i] * p[i+1] + x0[i]

print(p[k-1])
0