結果
| 問題 |
No.1237 EXP Multiple!
|
| コンテスト | |
| ユーザー |
259_Momone
|
| 提出日時 | 2020-09-25 22:48:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 121 ms / 2,000 ms |
| コード長 | 699 bytes |
| コンパイル時間 | 3,962 ms |
| コンパイル使用メモリ | 194,720 KB |
| 最終ジャッジ日時 | 2025-01-14 21:19:51 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
#include<bits/stdc++.h>
int main(){
using namespace std;
constexpr unsigned long MOD{1000000007};
unsigned long N;
cin >> N;
vector<unsigned long> A(N);
for(auto&& i : A)cin >> i;
if(any_of(begin(A), end(A), [](const auto& i){return i == 0;}))return 0 & puts("-1");
if(any_of(begin(A), end(A), [](const auto& i){return i >= 4;}))return 0 & puts("1000000007");
unsigned long ans{1};
for(const auto& i : A){
for(unsigned long j{[](const auto& x){unsigned long ret{1}; for(unsigned long i{1}; i <= x; ++i)ret *= i;return ret;}(i)}; j--; )ans *= i;
if(ans > MOD)return 0 & puts("1000000007");
}
cout << MOD % ans << endl;
return 0;
}
259_Momone