結果
問題 |
No.1237 EXP Multiple!
|
ユーザー |
|
提出日時 | 2020-09-25 23:12:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 771 bytes |
コンパイル時間 | 1,783 ms |
コンパイル使用メモリ | 198,760 KB |
最終ジャッジ日時 | 2025-01-14 21:31:32 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 18 RE * 1 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; const ll mod = int(1e9) + 7; int main() { ll N; cin >> N; vector<ll> a(N); rep(i, N) { cin >> a[i]; } sort(a.begin(), a.end()); if (a[0] == 0) { cout << -1 << endl; return 0; } ll ans = 1; rep(i, N) { if (a[i] >= 4) { cout << mod << endl; return 0; } ll div = 1; rep(j, a[i]) { div *= (j + 1); } // cerr << "div" << div << endl; rep(j, div) { ans *= a[i]; if (ans > (mod)) { break; } } } cout << mod % ans << endl; return 0; }