結果
| 問題 |
No.1237 EXP Multiple!
|
| コンテスト | |
| ユーザー |
hiraku
|
| 提出日時 | 2020-10-27 09:55:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 140 ms / 2,000 ms |
| コード長 | 396 bytes |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 33,292 KB |
| 最終ジャッジ日時 | 2024-07-21 21:52:14 |
| 合計ジャッジ時間 | 2,899 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
# 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)
hiraku