結果

問題 No.1084 積の積
ユーザー c-yanc-yan
提出日時 2020-06-19 23:19:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 574 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 21,440 KB
最終ジャッジ日時 2023-09-16 15:33:58
合計ジャッジ時間 19,322 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,924 KB
testcase_01 WA -
testcase_02 AC 15 ms
7,916 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 172 ms
10,324 KB
testcase_06 AC 201 ms
10,424 KB
testcase_07 AC 15 ms
7,884 KB
testcase_08 AC 15 ms
7,884 KB
testcase_09 AC 1,067 ms
18,204 KB
testcase_10 AC 15 ms
7,920 KB
testcase_11 WA -
testcase_12 WA -
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 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

B = [0] * N
B[0] = A[0]
for i in range(1, N):
    B[i] = pow(A[i], i + 1, 1000000007)
    B[i] *= B[i - 1]
    B[i] %= 1000000007
    
j = 0
t = 1
a = []
for i in range(N):
    t *= A[i]
    while t > 1000000007:
        t //= A[j]
        j += 1
    if j == 0:
        a.append(B[i])
    else:
        a.append(B[i] * pow(B[j - 1], 1000000007 - 2, 1000000007) * pow(pow(A[i], j + 1, 1000000007), 1000000007 - 2, 1000000007))

result = 1
for i in range(len(a)):
    result *= a[i]
    result %= 1000000007
print(result)
0