結果
| 問題 | No.1224 I hate Sqrt Inequality | 
| コンテスト | |
| ユーザー |  CELICA | 
| 提出日時 | 2020-09-11 22:56:40 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 108 ms / 2,000 ms | 
| コード長 | 930 bytes | 
| コンパイル時間 | 1,814 ms | 
| コンパイル使用メモリ | 178,048 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-23 20:03:57 | 
| 合計ジャッジ時間 | 2,714 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 13 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
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;
	if ((a % b) == 0)
	{
		cout << "No\n";
		return 0;
	}
	vector<pair<ll, ll> > va = primeFactorize(a);
	map<ll, ll> p;
	for (const auto& it : va)
		p[it.first] = it.second;
	vector<pair<ll, ll> > vb = primeFactorize(b);
	for (const auto& it : vb)
	{
		if (it.first != 2 && it.first != 5)
		{
			if ((ll)p.count(it.first) < it.second)
			{
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";
	return 0;
}
            
            
            
        