結果
問題 | No.1237 EXP Multiple! |
ユーザー |
|
提出日時 | 2020-09-25 21:47:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 586 bytes |
コンパイル時間 | 1,540 ms |
コンパイル使用メモリ | 168,956 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 08:32:50 |
合計ジャッジ時間 | 3,332 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> #define int long long using namespace std; const int mod=1000000007; int dat[]={1,1,2,6}; signed main(){ int N,ans=1; cin>>N; vector<int> A(N); for(int &i:A){ cin>>i; if(i==0){ puts("-1"); return 0; } } for(int a:A){ if(a>3){ cout<<mod<<endl; return 0; } for(int i=0;i<dat[a];i++){ ans*=a; if(ans>mod){ cout<<mod<<endl; return 0; } } } cout<<mod%ans<<endl; }