結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,772 KB
testcase_01 AC 15 ms
7,776 KB
testcase_02 AC 15 ms
7,932 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 174 ms
10,348 KB
testcase_06 AC 204 ms
10,388 KB
testcase_07 AC 15 ms
7,808 KB
testcase_08 AC 15 ms
7,776 KB
testcase_09 AC 1,056 ms
18,188 KB
testcase_10 AC 15 ms
7,836 KB
testcase_11 AC 51 ms
8,736 KB
testcase_12 AC 481 ms
13,636 KB
testcase_13 AC 1,017 ms
19,944 KB
testcase_14 AC 370 ms
12,256 KB
testcase_15 AC 341 ms
11,848 KB
testcase_16 AC 1,181 ms
21,400 KB
testcase_17 AC 436 ms
13,132 KB
testcase_18 AC 758 ms
16,712 KB
testcase_19 AC 1,037 ms
19,968 KB
testcase_20 AC 235 ms
10,612 KB
testcase_21 AC 372 ms
12,752 KB
testcase_22 AC 282 ms
11,668 KB
testcase_23 AC 615 ms
15,044 KB
testcase_24 AC 553 ms
14,548 KB
testcase_25 AC 1,027 ms
19,796 KB
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, 1000000007), 1000000007 - 2, 1000000007))

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