結果

問題 No.1330 Multiply or Divide
ユーザー Cyclone28Cyclone28
提出日時 2021-01-08 21:55:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 1,517 ms
コンパイル使用メモリ 169,272 KB
実行使用メモリ 6,760 KB
最終ジャッジ日時 2023-08-10 09:23:05
合計ジャッジ時間 5,066 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 70 ms
6,680 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 32 ms
4,644 KB
testcase_07 WA -
testcase_08 AC 84 ms
6,696 KB
testcase_09 AC 84 ms
5,712 KB
testcase_10 AC 84 ms
6,760 KB
testcase_11 AC 85 ms
6,676 KB
testcase_12 AC 84 ms
6,644 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
4,380 KB
testcase_17 WA -
testcase_18 AC 84 ms
6,696 KB
testcase_19 AC 83 ms
6,716 KB
testcase_20 AC 83 ms
6,692 KB
testcase_21 AC 83 ms
6,696 KB
testcase_22 AC 83 ms
6,636 KB
testcase_23 AC 90 ms
6,668 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,384 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 2 ms
4,384 KB
testcase_34 AC 63 ms
6,384 KB
testcase_35 AC 18 ms
4,380 KB
testcase_36 AC 56 ms
6,164 KB
testcase_37 AC 49 ms
5,076 KB
testcase_38 AC 32 ms
4,600 KB
testcase_39 AC 22 ms
4,380 KB
testcase_40 AC 26 ms
4,384 KB
testcase_41 AC 15 ms
4,376 KB
testcase_42 AC 46 ms
4,924 KB
testcase_43 AC 53 ms
5,064 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
  int n, m, p;
  cin >> n >> m >> p;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  bool flag = true, flag2 = true;
  for(int i = 0; i < n; i++) {
    if(a[i] % p != 0) flag = false;
    if(a[i] != 1) flag2 = false;
  }
  if(flag || flag2){
    cout << -1 << endl;
    return 0;
  }
  vector<int> b;
  for(int i = 0; i < n; i++){
    if(a[i] % p != 0) b.push_back(a[i]);
  }
  long long s = *max_element(b.begin(), b.end());
  int ans = 0;
  long long q = 1;
  while(q <= m){
    q *= s;
    ans++;
  }
  cout << ans << endl;
  return 0;
}
0