結果
問題 | No.1237 EXP Multiple! |
ユーザー |
![]() |
提出日時 | 2023-03-01 06:08:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 107 ms / 2,000 ms |
コード長 | 900 bytes |
コンパイル時間 | 4,432 ms |
コンパイル使用メモリ | 252,344 KB |
最終ジャッジ日時 | 2025-02-11 00:28:53 |
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll=int; using ld=long double; ld pie=3.14159265359; ll inf=80010010; ll mod=1000000007; int main(){ ll n; cin >> n; vector<ll>a(n); for (ll i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(),a.end(),greater<ll>()); if (a[a.size()-1]==0) { cout << -1 << endl; }else{ if (a[0]>=4) { cout << mod << endl; return 0; } ll x=1; for (ll i = 0; i < n; i++) { for (ll j = 0; j < a[i]*(a[i]-1); j++) { x*=a[i]; if (x>mod) { break; } } if (x>mod) { break; } } cout << mod%x << endl; } }