結果

問題 No.1237 EXP Multiple!
ユーザー polyesterpolyester
提出日時 2020-09-26 00:16:43
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 921 bytes
コンパイル時間 6,725 ms
コンパイル使用メモリ 103,416 KB
実行使用メモリ 7,736 KB
最終ジャッジ日時 2023-09-10 17:18:50
合計ジャッジ時間 7,629 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  ll limit = 1000000007;
  int n;
  cin >> n;
  ll num = 1;
  for(int i = 0; i < n; i++) {
    ll tmp, a, cnt = 1;
    cin >> a;
    if(a < 2) {
      continue;
    }
    tmp = a;
    while(tmp--) {
      cnt *= (tmp + 1);
    }
    for(int j = 0; j < cnt; j++) {
      if(num > limit / a) {
        cout << limit << '\n';
        return 0;
      }
      num *= a;
      if(limit % num == 0) {
        cout << -1 << '\n';
        return 0;
      } else if(num > limit) {
        cout << limit << '\n';
        return 0;
      }
    }
  }
  if(limit % num == 0) {
    cout << -1 << '\n';
  } else {
    cout << limit % num << '\n';
  }
  return 0;
}
0