結果

問題 No.1330 Multiply or Divide
ユーザー Cyclone28Cyclone28
提出日時 2021-01-08 21:48:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 3,201 ms
コンパイル使用メモリ 166,772 KB
実行使用メモリ 4,988 KB
最終ジャッジ日時 2023-08-10 09:13:02
合計ジャッジ時間 5,186 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 64 ms
4,852 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 29 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 78 ms
4,856 KB
testcase_09 AC 78 ms
4,460 KB
testcase_10 AC 78 ms
4,856 KB
testcase_11 AC 78 ms
4,808 KB
testcase_12 AC 78 ms
4,932 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 WA -
testcase_18 AC 77 ms
4,908 KB
testcase_19 AC 75 ms
4,848 KB
testcase_20 AC 76 ms
4,804 KB
testcase_21 AC 76 ms
4,988 KB
testcase_22 AC 76 ms
4,856 KB
testcase_23 AC 82 ms
4,852 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 59 ms
4,652 KB
testcase_35 AC 17 ms
4,380 KB
testcase_36 AC 51 ms
4,580 KB
testcase_37 AC 45 ms
4,376 KB
testcase_38 AC 30 ms
4,376 KB
testcase_39 AC 21 ms
4,380 KB
testcase_40 AC 25 ms
4,376 KB
testcase_41 AC 14 ms
4,380 KB
testcase_42 AC 43 ms
4,380 KB
testcase_43 AC 49 ms
4,408 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int 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;
  for(int i = 0; i < n; i++) if(a[i] % p != 0) flag = false;
  if(flag){
    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