結果

問題 No.1237 EXP Multiple!
ユーザー marroncastle
提出日時 2020-09-25 21:43:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 105,964 KB
最終ジャッジ日時 2024-06-28 06:17:50
合計ジャッジ時間 2,880 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(-1)
  exit()
ans = 1
for i in range(N):
  prod = A[i]
  for j in range(2,A[i]+1):
    prod = pow(prod,j)
    if ans*prod>mod:
      print(mod)
      exit()
  ans *= prod
ans = mod%ans
if ans==0:
  print(-1)
else:
  print(ans)
0