結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー shisidor
提出日時 2023-04-01 17:49:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 759 bytes
コンパイル時間 892 ms
コンパイル使用メモリ 77,992 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 11:09:20
合計ジャッジ時間 2,840 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
using namespace std;

int main() {
    long long x, y, a, b;
    cin >> x >> a >> y >> b;
    map<int, int> mpa;
    map<int, int> mpb;
    for (int i = 2; i < 1000000; i++) {
        while(x % i == 0) {
            x /= i;
            mpa[i]++;
        }
        if (x == 1) break;
        if (i == 999999) mpa[x]++;
    }
    for (int i = 2; i < 1000000; i++) {
        while(y % i == 0) {
            y /= i;
            mpb[i]++;
        }
        if (y == 1) break;
        if (i == 999999) mpb[y]++;
    }
    bool res = true;
    for (auto p : mpb) {
        if ((long long)a * mpa[p.first] < (long long)b * p.second) res = false;
    }
    if (res) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}
0