結果

問題 No.1501 酔歩
ユーザー tamatotamato
提出日時 2021-05-07 21:43:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 783 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,452 KB
実行使用メモリ 91,388 KB
最終ジャッジ日時 2023-10-13 12:43:17
合計ジャッジ時間 10,616 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,708 KB
testcase_01 AC 72 ms
71,772 KB
testcase_02 AC 74 ms
71,576 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 171 ms
87,740 KB
testcase_06 AC 147 ms
84,516 KB
testcase_07 AC 162 ms
87,600 KB
testcase_08 AC 96 ms
77,188 KB
testcase_09 AC 162 ms
86,388 KB
testcase_10 AC 113 ms
79,536 KB
testcase_11 AC 151 ms
85,100 KB
testcase_12 AC 106 ms
81,400 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 172 ms
91,116 KB
testcase_23 AC 189 ms
91,224 KB
testcase_24 AC 178 ms
91,264 KB
testcase_25 AC 166 ms
91,032 KB
testcase_26 AC 143 ms
91,216 KB
testcase_27 AC 169 ms
91,380 KB
testcase_28 AC 203 ms
91,272 KB
testcase_29 AC 148 ms
91,096 KB
testcase_30 AC 188 ms
91,208 KB
testcase_31 AC 151 ms
91,156 KB
testcase_32 AC 157 ms
91,024 KB
testcase_33 AC 197 ms
91,388 KB
testcase_34 AC 178 ms
91,152 KB
testcase_35 AC 167 ms
91,044 KB
testcase_36 AC 185 ms
91,280 KB
testcase_37 AC 146 ms
91,052 KB
testcase_38 AC 157 ms
91,120 KB
testcase_39 AC 206 ms
91,372 KB
testcase_40 AC 160 ms
91,196 KB
testcase_41 AC 194 ms
91,056 KB
testcase_42 AC 120 ms
90,728 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 124 ms
90,864 KB
testcase_46 AC 128 ms
90,740 KB
testcase_47 AC 116 ms
90,616 KB
testcase_48 AC 126 ms
90,676 KB
testcase_49 AC 133 ms
91,008 KB
testcase_50 AC 121 ms
90,708 KB
testcase_51 AC 122 ms
90,800 KB
testcase_52 AC 121 ms
90,944 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 76 ms
71,412 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(0)
        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
    print(str(u) + "/" + str(l))


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