結果
問題 | No.1723 [Cherry 3rd Tune *] Dead on |
ユーザー |
![]() |
提出日時 | 2024-07-28 12:15:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 986 bytes |
コンパイル時間 | 2,104 ms |
コンパイル使用メモリ | 173,520 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-28 12:15:13 |
合計ジャッジ時間 | 3,981 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i<n; ++i) #define repl(i,m,n) for(ll i=m; i<n; ++i) map<ll, ll> prime_fact(ll N){ map<ll, ll> res; for(ll i = 2LL; i*i <= N; ++i){ if(N % i != 0LL) continue; ll ex = 0LL; while(N % i == 0){ N /= i; ex++; } res[i] = ex; } if(N != 1LL) res[N] = 1LL; return res; } int main(){ ll X, A, Y, B; cin >> X >> A >> Y >> B; auto pf_X = prime_fact(X), pf_Y = prime_fact(Y); for(auto &p : pf_X){ p.second = p.second * A; } for(auto &p : pf_Y){ p.second = p.second * B; } for(auto p : pf_Y){ ll a = p.first; if(pf_X.find(a) == pf_X.end()){ cout << "No" << endl; return 0; }else if(pf_X[a] < p.second){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }