結果
問題 |
No.1237 EXP Multiple!
|
ユーザー |
![]() |
提出日時 | 2020-08-25 21:44:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 626 bytes |
コンパイル時間 | 5,523 ms |
コンパイル使用メモリ | 192,588 KB |
最終ジャッジ日時 | 2025-01-13 14:46:07 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define FOR(i,l,r) for(long long i=(l);i<(r);++i) #define REP(i,n) FOR(i,0,n) int d[4] = {1, 1, 2, 6}; const int MOD = 1e9 + 7; int main(){ int n; cin >> n; vector<int> a(n); REP(i, n) cin >> a[i]; REP(i, n) if(!a[i]){ cout << -1 << endl; return 0; } long long mul = 1; REP(i, n){ if(a[i] >= 4){ cout << MOD << endl; return 0; } mul *= pow(a[i], d[a[i]]); if(mul > MOD){ cout << MOD << endl; return 0; } } cout << MOD % mul << endl; }