結果
問題 |
No.1224 I hate Sqrt Inequality
|
ユーザー |
![]() |
提出日時 | 2020-09-11 22:02:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 864 bytes |
コンパイル時間 | 2,386 ms |
コンパイル使用メモリ | 170,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-27 12:43:53 |
合計ジャッジ時間 | 2,775 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ul = unsigned long; using ull = unsigned long long; bool isPrime(ll n) { if (n == 1) return false; for (ll i = 2; i * i <= n; ++i) { if (n % i == 0) return false; } return true; } vector<pair<ll, ll> > primeFactorize(ll n) { vector<pair<ll, ll> > res; for (ll a = 2; a * a <= n; ++a) { if (n % a != 0) continue; ll ex = 0; while (n % a == 0) { ++ex; n /= a; } res.push_back({ a, ex }); } if (n != 1) res.push_back({ n, 1 }); return res; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll a, b; cin >> a >> b; vector<pair<ll, ll> > v = primeFactorize(b); for (const auto& it : v) { if (it.first !=2 && it.first != 5 && isPrime(it.first)) { cout << "Yes\n"; return 0; } } cout << "No\n"; return 0; }