結果

問題 No.1501 酔歩
ユーザー convexineqconvexineq
提出日時 2021-05-07 22:22:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 605 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 119,428 KB
最終ジャッジ日時 2023-10-13 13:37:31
合計ジャッジ時間 26,919 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 233 ms
88,972 KB
testcase_01 AC 228 ms
89,152 KB
testcase_02 AC 229 ms
89,344 KB
testcase_03 AC 233 ms
89,224 KB
testcase_04 AC 231 ms
89,260 KB
testcase_05 AC 502 ms
112,388 KB
testcase_06 AC 482 ms
106,532 KB
testcase_07 AC 492 ms
112,068 KB
testcase_08 AC 379 ms
96,076 KB
testcase_09 AC 488 ms
109,224 KB
testcase_10 AC 416 ms
96,820 KB
testcase_11 AC 445 ms
106,292 KB
testcase_12 AC 484 ms
102,272 KB
testcase_13 AC 230 ms
89,228 KB
testcase_14 AC 229 ms
88,908 KB
testcase_15 AC 229 ms
88,988 KB
testcase_16 AC 232 ms
89,208 KB
testcase_17 AC 232 ms
89,036 KB
testcase_18 AC 230 ms
89,144 KB
testcase_19 AC 234 ms
89,192 KB
testcase_20 AC 232 ms
88,912 KB
testcase_21 AC 230 ms
89,108 KB
testcase_22 AC 563 ms
119,428 KB
testcase_23 AC 599 ms
119,012 KB
testcase_24 AC 604 ms
119,080 KB
testcase_25 AC 605 ms
119,176 KB
testcase_26 AC 574 ms
118,984 KB
testcase_27 AC 519 ms
118,668 KB
testcase_28 AC 564 ms
118,656 KB
testcase_29 AC 553 ms
119,152 KB
testcase_30 AC 601 ms
119,056 KB
testcase_31 AC 525 ms
119,124 KB
testcase_32 AC 518 ms
119,280 KB
testcase_33 AC 529 ms
119,184 KB
testcase_34 AC 583 ms
119,340 KB
testcase_35 AC 558 ms
119,428 KB
testcase_36 AC 575 ms
119,244 KB
testcase_37 AC 543 ms
119,112 KB
testcase_38 AC 544 ms
119,264 KB
testcase_39 AC 549 ms
118,988 KB
testcase_40 AC 561 ms
118,968 KB
testcase_41 AC 519 ms
119,180 KB
testcase_42 AC 353 ms
119,292 KB
testcase_43 AC 233 ms
88,980 KB
testcase_44 AC 231 ms
89,068 KB
testcase_45 AC 350 ms
118,988 KB
testcase_46 AC 351 ms
119,024 KB
testcase_47 AC 351 ms
119,096 KB
testcase_48 AC 513 ms
119,208 KB
testcase_49 AC 522 ms
119,404 KB
testcase_50 AC 523 ms
119,188 KB
testcase_51 AC 556 ms
119,212 KB
testcase_52 AC 523 ms
119,132 KB
testcase_53 AC 233 ms
89,300 KB
testcase_54 AC 230 ms
89,248 KB
testcase_55 AC 234 ms
89,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction as F
n,k = map(int,input().split())
*a, = map(int,input().split())
if k==1:
    if n==1: print("1/1")
    else: print(0)
    exit()
a = [F(0)]+[F(a[i-1],a[i-1]+a[i+1]) for i in range(1,n-1)]+[F(0)]
r = [F(0)]*n
r[1] = F(1)
for i in range(2,n):
    r[i] = (r[i-1]-r[i-2]*a[i-1])/(F(1)-a[i-1])
# 1 = a+b, r[k-1] = r[-1]b
ans = r[k-1]/r[-1]
print(f"{ans.numerator}/{ans.denominator}")
0