結果

問題 No.1501 酔歩
ユーザー tamatotamato
提出日時 2021-05-07 21:51:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 833 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 91,296 KB
最終ジャッジ日時 2023-10-13 12:53:48
合計ジャッジ時間 8,166 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,700 KB
testcase_01 AC 65 ms
71,488 KB
testcase_02 AC 70 ms
71,552 KB
testcase_03 AC 71 ms
71,508 KB
testcase_04 WA -
testcase_05 AC 160 ms
87,492 KB
testcase_06 AC 136 ms
84,692 KB
testcase_07 AC 151 ms
87,484 KB
testcase_08 AC 80 ms
77,012 KB
testcase_09 AC 133 ms
86,132 KB
testcase_10 AC 91 ms
79,360 KB
testcase_11 AC 124 ms
85,084 KB
testcase_12 AC 87 ms
81,508 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 142 ms
91,004 KB
testcase_23 AC 158 ms
91,064 KB
testcase_24 AC 145 ms
90,824 KB
testcase_25 AC 135 ms
90,952 KB
testcase_26 AC 119 ms
90,984 KB
testcase_27 AC 141 ms
91,100 KB
testcase_28 AC 166 ms
90,844 KB
testcase_29 AC 124 ms
90,980 KB
testcase_30 AC 154 ms
91,128 KB
testcase_31 AC 124 ms
90,928 KB
testcase_32 AC 131 ms
91,296 KB
testcase_33 AC 159 ms
90,876 KB
testcase_34 AC 147 ms
90,948 KB
testcase_35 AC 139 ms
91,096 KB
testcase_36 AC 152 ms
90,832 KB
testcase_37 AC 119 ms
90,944 KB
testcase_38 AC 136 ms
90,896 KB
testcase_39 AC 186 ms
90,948 KB
testcase_40 AC 134 ms
90,972 KB
testcase_41 AC 162 ms
90,888 KB
testcase_42 AC 97 ms
90,836 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 101 ms
90,616 KB
testcase_46 AC 107 ms
90,656 KB
testcase_47 AC 96 ms
90,632 KB
testcase_48 AC 102 ms
90,688 KB
testcase_49 AC 110 ms
90,668 KB
testcase_50 AC 101 ms
90,580 KB
testcase_51 AC 113 ms
90,720 KB
testcase_52 AC 105 ms
90,580 KB
testcase_53 WA -
testcase_54 AC 67 ms
71,576 KB
testcase_55 AC 62 ms
71,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from math import gcd
    input = sys.stdin.readline

    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    if K == 1:
        print(0)
        exit()

    if K == N:
        print("1/1")
        exit()

    upper = [0] * N
    lower = [1] * N
    for i in range(1, N-1):
        a = A[i-1]
        b = A[i+1]
        upper[i] = lower[i-1] * b
        lower[i] = lower[i-1] * (a+b) - a * upper[i-1]
        g = gcd(upper[i], lower[i])
        upper[i] //= g
        lower[i] //= g

    u = l = 1
    for i in range(K-1, N-1):
        u *= upper[i]
        l *= lower[i]
        g = gcd(u, l)
        u //= g
        l //= g
    if u == 0:
        print(0)
    else:
        print(str(u) + "/" + str(l))


if __name__ == '__main__':
    main()
0