結果

問題 No.1501 酔歩
ユーザー H3PO4H3PO4
提出日時 2023-10-08 10:22:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 16,604 KB
最終ジャッジ日時 2023-10-08 10:23:05
合計ジャッジ時間 5,154 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,928 KB
testcase_01 AC 16 ms
8,312 KB
testcase_02 AC 15 ms
7,996 KB
testcase_03 AC 15 ms
7,988 KB
testcase_04 AC 15 ms
8,372 KB
testcase_05 AC 65 ms
12,968 KB
testcase_06 AC 52 ms
11,984 KB
testcase_07 AC 63 ms
13,000 KB
testcase_08 AC 26 ms
9,172 KB
testcase_09 AC 61 ms
12,608 KB
testcase_10 AC 32 ms
10,032 KB
testcase_11 AC 52 ms
12,076 KB
testcase_12 AC 44 ms
10,908 KB
testcase_13 AC 15 ms
8,372 KB
testcase_14 AC 16 ms
8,400 KB
testcase_15 AC 15 ms
8,248 KB
testcase_16 AC 15 ms
8,364 KB
testcase_17 AC 15 ms
8,296 KB
testcase_18 AC 15 ms
8,376 KB
testcase_19 AC 15 ms
8,292 KB
testcase_20 AC 17 ms
8,412 KB
testcase_21 AC 15 ms
8,248 KB
testcase_22 AC 78 ms
14,624 KB
testcase_23 AC 79 ms
14,788 KB
testcase_24 AC 79 ms
14,748 KB
testcase_25 AC 80 ms
14,792 KB
testcase_26 AC 80 ms
14,628 KB
testcase_27 AC 79 ms
14,736 KB
testcase_28 AC 81 ms
14,740 KB
testcase_29 AC 79 ms
14,612 KB
testcase_30 AC 76 ms
14,620 KB
testcase_31 AC 84 ms
14,676 KB
testcase_32 AC 81 ms
14,744 KB
testcase_33 AC 79 ms
14,780 KB
testcase_34 AC 78 ms
14,752 KB
testcase_35 AC 79 ms
14,792 KB
testcase_36 AC 79 ms
14,636 KB
testcase_37 AC 82 ms
14,736 KB
testcase_38 AC 78 ms
14,604 KB
testcase_39 AC 81 ms
14,636 KB
testcase_40 AC 79 ms
14,688 KB
testcase_41 AC 77 ms
14,744 KB
testcase_42 AC 83 ms
16,604 KB
testcase_43 AC 16 ms
8,368 KB
testcase_44 AC 15 ms
8,284 KB
testcase_45 AC 78 ms
14,364 KB
testcase_46 AC 82 ms
14,500 KB
testcase_47 AC 77 ms
14,432 KB
testcase_48 AC 83 ms
14,556 KB
testcase_49 AC 81 ms
14,428 KB
testcase_50 AC 82 ms
14,440 KB
testcase_51 AC 84 ms
14,660 KB
testcase_52 AC 83 ms
14,644 KB
testcase_53 AC 15 ms
8,416 KB
testcase_54 AC 15 ms
7,996 KB
testcase_55 AC 15 ms
8,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd, lcm

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

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

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

lcm_all = lcm(*((i * j) for i in range(1, 11) for j in range(1, 11)))

dp = [0] * N
for i in range(N - 1):
    dp[i + 1] = dp[i] + lcm_all // (A[i] * A[i + 1])
denominator = dp[-1]
numerator = dp[K - 1]
g = gcd(numerator, denominator)
denominator //= g
numerator //= g
print(f"{numerator}/{denominator}")
0