結果

問題 No.1330 Multiply or Divide
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2021-01-08 21:45:14
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 696 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 163,256 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 02:36:33
合計ジャッジ時間 4,046 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 58 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 33 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 86 ms
5,376 KB
testcase_09 AC 88 ms
5,376 KB
testcase_10 AC 98 ms
5,376 KB
testcase_11 AC 88 ms
5,376 KB
testcase_12 AC 99 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 85 ms
5,376 KB
testcase_19 AC 84 ms
5,376 KB
testcase_20 AC 84 ms
5,376 KB
testcase_21 AC 85 ms
5,376 KB
testcase_22 AC 83 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 WA -
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 62 ms
5,376 KB
testcase_35 AC 18 ms
5,376 KB
testcase_36 AC 56 ms
5,376 KB
testcase_37 AC 49 ms
5,376 KB
testcase_38 AC 31 ms
5,376 KB
testcase_39 AC 22 ms
5,376 KB
testcase_40 AC 26 ms
5,376 KB
testcase_41 AC 13 ms
5,376 KB
testcase_42 AC 45 ms
5,376 KB
testcase_43 AC 52 ms
5,376 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2021.01.08 21:45:08
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n,m,p;cin >> n >> m >> p;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (p == 1) continue;
        while (a[i] % p == 0) {
            a[i] /= p;
        }
    }
    sort(a.rbegin(), a.rend());
    int ans = 0;
    ll x = 1;
    if (x >= m) {
        cout << 0 << endl;
        return 0;
    }
    if (p == 1 || a[0] == 1) {
        cout << -1 << endl;
        return 0;
    }
    while(x < m) {
        x *= a[0];
        ans++;
    }
    cout << ans << endl;
    return 0;
}
0