結果

問題 No.1237 EXP Multiple!
ユーザー polyesterpolyester
提出日時 2020-09-26 00:04:32
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 920 bytes
コンパイル時間 833 ms
コンパイル使用メモリ 104,440 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-10 17:16:15
合計ジャッジ時間 2,064 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;
    cin >> a;
    if(a < 2) {
      continue;
    }
    tmp = a;
    while(tmp--) {
      for(int j = 0; j < tmp + 1; j++) {
        if(num > limit / a) {
          cout << limit << '\n';
          return 0;
        }
        num *= a;
        if(num > limit) {
          cout << limit << '\n';
          return 0;
        } else if(limit % num == 0) {
          cout << -1 << '\n';
          return 0;
        }
      }
    }
  }
  if(limit % num == 0) {
    cout << -1 << '\n';
  } else {
    cout << limit % num << '\n';
  }
  return 0;
}
0