結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,860 KB
testcase_01 WA -
testcase_02 AC 16 ms
7,856 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 175 ms
10,368 KB
testcase_06 AC 203 ms
10,308 KB
testcase_07 AC 16 ms
7,900 KB
testcase_08 AC 15 ms
7,780 KB
testcase_09 AC 608 ms
18,064 KB
testcase_10 AC 16 ms
7,780 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))

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