結果

問題 No.1330 Multiply or Divide
ユーザー
提出日時 2021-01-08 21:28:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 775 bytes
コンパイル時間 754 ms
コンパイル使用メモリ 91,464 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 10:12:05
合計ジャッジ時間 3,990 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long a[200020];
int main() {
    long long n, m, p;
    cin >> n >> m >> p;
    long long ans = 1;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        while (a[i] % p == 0) {
            a[i] /= p;
        }
        if (ans < a[i]) {
            ans = a[i];
        }
    }
    if (ans == 1) {
        cout << "-1" << endl;
    }
    else {
        int co = 0;
        while (m >= 1) {
            m /= ans;
            co++;
        }
        cout << co << endl;
    }
}
0