結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,712 KB
testcase_01 AC 71 ms
71,324 KB
testcase_02 AC 76 ms
71,812 KB
testcase_03 AC 73 ms
71,832 KB
testcase_04 WA -
testcase_05 AC 166 ms
87,768 KB
testcase_06 AC 144 ms
84,668 KB
testcase_07 AC 161 ms
87,740 KB
testcase_08 AC 93 ms
77,064 KB
testcase_09 AC 159 ms
86,284 KB
testcase_10 AC 109 ms
79,252 KB
testcase_11 AC 145 ms
84,960 KB
testcase_12 AC 105 ms
81,404 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 173 ms
91,108 KB
testcase_23 AC 189 ms
91,016 KB
testcase_24 AC 174 ms
91,108 KB
testcase_25 AC 161 ms
91,148 KB
testcase_26 AC 141 ms
90,804 KB
testcase_27 AC 168 ms
91,368 KB
testcase_28 AC 198 ms
91,132 KB
testcase_29 AC 146 ms
91,064 KB
testcase_30 AC 184 ms
91,128 KB
testcase_31 AC 151 ms
91,136 KB
testcase_32 AC 155 ms
91,172 KB
testcase_33 AC 190 ms
91,124 KB
testcase_34 AC 178 ms
91,336 KB
testcase_35 AC 164 ms
91,188 KB
testcase_36 AC 182 ms
91,236 KB
testcase_37 AC 143 ms
91,060 KB
testcase_38 AC 154 ms
91,004 KB
testcase_39 AC 203 ms
91,276 KB
testcase_40 AC 157 ms
91,320 KB
testcase_41 AC 192 ms
91,320 KB
testcase_42 AC 119 ms
90,876 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 122 ms
90,716 KB
testcase_46 AC 127 ms
90,716 KB
testcase_47 AC 114 ms
90,600 KB
testcase_48 AC 120 ms
90,680 KB
testcase_49 AC 132 ms
91,088 KB
testcase_50 AC 120 ms
90,896 KB
testcase_51 AC 121 ms
90,932 KB
testcase_52 AC 120 ms
90,752 KB
testcase_53 WA -
testcase_54 AC 73 ms
71,612 KB
testcase_55 AC 72 ms
71,856 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
    print(str(u) + "/" + str(l))


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