結果
| 問題 |
No.1237 EXP Multiple!
|
| コンテスト | |
| ユーザー |
shell_mug
|
| 提出日時 | 2020-09-25 22:13:52 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 2,706 bytes |
| コンパイル時間 | 1,710 ms |
| コンパイル使用メモリ | 147,584 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 06:35:52 |
| 合計ジャッジ時間 | 3,807 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 WA * 1 RE * 4 |
ソースコード
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>
// AtCoder
// #include <atcoder/all>
// using namespace atcoder;
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...)
#endif
#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;
constexpr int MOD = 1000000007;
// + - * / ^
int mod(int a)
{
int res = a % MOD;
if(res < 0) {
return res + MOD;
}
return res;
}
int mul_mod(int a, int b)
{
ll res = ((ll)a * (ll)b) % MOD;
return mod((int)res);
}
int pow_mod(int a, int b)
{
ll res = 1;
while (b > 0) {
if(b & 1) {
res = res * (ll)a % (ll)MOD;
}
a = mul_mod(a, a);
b >>= 1;
}
return (int)res;
}
int inv_mod(int a)
{
return pow_mod(a, MOD - 2);
}
int div_mod(int a, int b)
{
return mul_mod(a, inv_mod(b));
}
// ! C
constexpr int FAC_MAX = 51;
ll fac[FAC_MAX];
void com_init()
{
fac[0] = fac[1] = 1;
for (int i = 2; i < FAC_MAX; i++){
fac[i] = fac[i - 1] * i % (MOD - 1);
}
}
int main (void)
{
cin.tie(0);
ios::sync_with_stdio(false);
com_init();
ll n; cin >> n;
ll x = 1;
rep (i, n) {
ll a; cin >> a;
if (a >= 30) goto y;
if (a == 1) continue;
rep (i, fac[a]) {
x = a * x;
if (x > MOD) goto y;
}
}
goto z;
y:
cout << MOD << "\n";
return 0;
z:
cout << MOD % x << "\n";
/***************************************************/
/* Use "submit code (with ACL v1)" when using ACL! */
/***************************************************/
return 0;
}
shell_mug