結果
問題 | No.1723 [Cherry 3rd Tune *] Dead on |
ユーザー |
|
提出日時 | 2021-10-29 22:41:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,029 bytes |
コンパイル時間 | 817 ms |
コンパイル使用メモリ | 71,780 KB |
最終ジャッジ日時 | 2025-01-25 09:16:15 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 WA * 20 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main() { long long x, y, a, b; cin >> x >> a >> y >> b; if (y == 1) { cout << "Yes" << endl; return 0; } if (x == y && a >= b) { cout << "Yes" << endl; return 0; } long long x_ = x; long long y_ = y; vector<long long> cnt_x(1000000, 0), cnt_y(1000000, 0); for (long long i = 2; i < 1000000; i++) { while (x % i == 0) { x /= i; cnt_x[i]++; } } for (long long i = 2; i < 1000000; i++) { while (y % i == 0) { y /= i; cnt_y[i]++; } } if (x % y != 0) { cout << "No" << endl; return 0; } for (int i = 2; i < 1000000; i++) { if (cnt_x[i] * a < cnt_y[i] * b) { cout << "No" << endl; cout << i << endl; return 0; } } if (y != 1 && a < b) { cout << "No" << endl; return 0; } cout << "Yes" << endl; }