結果

問題 No.1330 Multiply or Divide
ユーザー oliverx3oliverx3
提出日時 2021-01-08 21:30:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 1,362 ms
コンパイル使用メモリ 174,076 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-04-28 02:06:44
合計ジャッジ時間 6,535 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
// #include<atcoder/all>
// using namespace std;
// using namespace atcoder;
// #define int long long
#define rep(i, n) for(int i = 0;i<(int)(n);i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using lint = long long;
using P = std::pair<int,int>;

int main(void) {
    int n,m,p;
    std::cin >> n >> m >> p;
    std::vector<int> v(n);
    rep(i, n) {
        std::cin >> v[i];
        if(v[i]<=m&&v[i]%p==0) {
            while(v[i]%p==0) v[i]/=p;
        }
    }
    std::sort(v.rbegin(),v.rend());
    int ans = 0;
    if(v.front()==1) ans=-1;
    else {
        int x = 1;
        while(x<=m) x*=v.front(),ans++;
    }
    std::cout << ans << std::endl;
    return 0;
}
0