結果
| 問題 | No.1237 EXP Multiple! |
| コンテスト | |
| ユーザー |
piddy
|
| 提出日時 | 2020-09-25 23:21:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 764 bytes |
| 記録 | |
| コンパイル時間 | 1,830 ms |
| コンパイル使用メモリ | 197,548 KB |
| 最終ジャッジ日時 | 2025-01-14 21:37:55 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 RE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int P = 1000000007;
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
sort(a.begin(), a.end());
if (a[0] == 0) {
cout << -1 << endl;
return 0;
}
long long pi = 1;
for (int i = 0; i < n; i++) {
long long subpi = 1;
for (int j = 1; j <= a[i]; j++) {
subpi *= j;
if (subpi > P) {
cout << P << endl;
return 0;
}
}
while (subpi--) {
pi *= a[i];
if (subpi > P) {
cout << P << endl;
return 0;
}
}
}
cout << P % pi << endl;
return 0;
}
piddy