結果

問題 No.1501 酔歩
ユーザー chocoruskchocorusk
提出日時 2021-05-09 13:10:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 81,708 KB
実行使用メモリ 101,756 KB
最終ジャッジ日時 2023-10-18 23:25:48
合計ジャッジ時間 20,662 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
87,736 KB
testcase_01 AC 154 ms
87,664 KB
testcase_02 AC 149 ms
87,728 KB
testcase_03 AC 152 ms
87,664 KB
testcase_04 AC 150 ms
87,668 KB
testcase_05 AC 382 ms
98,300 KB
testcase_06 AC 351 ms
95,508 KB
testcase_07 AC 371 ms
98,412 KB
testcase_08 AC 261 ms
90,844 KB
testcase_09 AC 351 ms
96,828 KB
testcase_10 AC 285 ms
91,028 KB
testcase_11 AC 342 ms
95,484 KB
testcase_12 AC 314 ms
93,240 KB
testcase_13 AC 149 ms
87,684 KB
testcase_14 AC 147 ms
87,680 KB
testcase_15 AC 149 ms
87,684 KB
testcase_16 AC 147 ms
87,680 KB
testcase_17 AC 151 ms
87,680 KB
testcase_18 AC 147 ms
87,680 KB
testcase_19 AC 148 ms
87,672 KB
testcase_20 AC 148 ms
87,676 KB
testcase_21 AC 152 ms
87,680 KB
testcase_22 AC 423 ms
101,492 KB
testcase_23 AC 435 ms
101,488 KB
testcase_24 AC 426 ms
101,492 KB
testcase_25 AC 431 ms
101,492 KB
testcase_26 AC 433 ms
101,492 KB
testcase_27 AC 421 ms
101,484 KB
testcase_28 AC 427 ms
101,484 KB
testcase_29 AC 441 ms
101,488 KB
testcase_30 AC 437 ms
101,488 KB
testcase_31 AC 436 ms
101,492 KB
testcase_32 AC 426 ms
101,488 KB
testcase_33 AC 423 ms
101,488 KB
testcase_34 AC 438 ms
101,488 KB
testcase_35 AC 442 ms
101,488 KB
testcase_36 AC 442 ms
101,492 KB
testcase_37 AC 446 ms
101,488 KB
testcase_38 AC 434 ms
101,492 KB
testcase_39 AC 436 ms
101,488 KB
testcase_40 AC 430 ms
101,488 KB
testcase_41 AC 438 ms
101,496 KB
testcase_42 AC 281 ms
101,224 KB
testcase_43 AC 151 ms
87,676 KB
testcase_44 AC 149 ms
87,680 KB
testcase_45 AC 277 ms
101,496 KB
testcase_46 AC 281 ms
101,492 KB
testcase_47 AC 281 ms
101,492 KB
testcase_48 AC 393 ms
100,956 KB
testcase_49 AC 446 ms
101,024 KB
testcase_50 AC 434 ms
100,960 KB
testcase_51 AC 416 ms
100,956 KB
testcase_52 AC 431 ms
101,756 KB
testcase_53 AC 148 ms
87,680 KB
testcase_54 AC 151 ms
87,680 KB
testcase_55 AC 149 ms
87,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction
n, k=map(int, input().split())
a=list(map(int, input().split()))
if k==n:
    print("1/1")
    exit()
elif k==1:
    print(0)
    exit()
k-=1
q=[Fraction(0)]*n
q[1]=Fraction(1)
for i in range(2, n):
    q[i]=((a[i-2]+a[i])*q[i-1]-a[i-2]*q[i-2])/Fraction(a[i])
print(q[k]/q[n-1])
0