結果

問題 No.1237 EXP Multiple!
ユーザー hirakuhiraku
提出日時 2020-10-27 09:55:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,696 KB
実行使用メモリ 30,744 KB
最終ジャッジ日時 2023-09-29 03:12:46
合計ジャッジ時間 2,958 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,012 KB
testcase_01 AC 69 ms
23,748 KB
testcase_02 AC 92 ms
29,228 KB
testcase_03 AC 86 ms
30,236 KB
testcase_04 AC 87 ms
30,744 KB
testcase_05 AC 50 ms
12,316 KB
testcase_06 AC 69 ms
12,132 KB
testcase_07 AC 52 ms
12,240 KB
testcase_08 AC 124 ms
12,192 KB
testcase_09 AC 51 ms
12,228 KB
testcase_10 AC 50 ms
12,120 KB
testcase_11 AC 70 ms
12,240 KB
testcase_12 AC 109 ms
12,168 KB
testcase_13 AC 118 ms
12,184 KB
testcase_14 AC 117 ms
12,328 KB
testcase_15 AC 116 ms
12,256 KB
testcase_16 AC 116 ms
12,284 KB
testcase_17 AC 119 ms
12,188 KB
testcase_18 AC 116 ms
12,332 KB
testcase_19 AC 59 ms
12,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# No.1237 EXP Multiple!
# https://yukicoder.me/problems/no/1237

from math import factorial

def f(x):
  return x ** factorial(x)

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

MOD = 10 ** 9 + 7

if any(a == 0 for a in A):
  print(-1)
  exit()

if any(a > 9 for a in A):
  print(MOD)
  exit()

ans = 1
for a in A:
  if ans >= MOD:
    print(MOD)
    exit()
  ans *= f(a)

print(MOD % ans)
0