結果
問題 |
No.1237 EXP Multiple!
|
ユーザー |
![]() |
提出日時 | 2020-09-25 23:20:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 652 bytes |
コンパイル時間 | 1,604 ms |
コンパイル使用メモリ | 194,700 KB |
最終ジャッジ日時 | 2025-01-14 21:37:37 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 WA * 2 RE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { const int x[4] = { 0, 1, 4, 729 }; int n; cin >> n; vector<int> a(n); bool big = false; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << -1 << endl; return 0; } if (a[i] >= 4) { big = true; } } if (big) { cout << 1000000007 << endl; return 0; } int64_t p = 1; for (int i = 0; i < n; i++) { p *= x[a[i]]; if (p >= 1000000007) { cout << 1000000007 << endl; } } cout << 1000000007 % p << endl; }