結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー 沙耶花
提出日時 2021-10-29 21:28:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 5,848 ms
コンパイル使用メモリ 255,440 KB
最終ジャッジ日時 2025-01-25 08:26:51
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 10000000000000000

map<long long,long long> get(long long n){
	map<long long,long long> ret;
	for(long long i=2;i*i<=n;i++){
		while(n%i==0){
			ret[i]++;
			n/=i;
		}
	}
	if(n!=1)ret[n]++;
	return ret;
}
void NG(){
	cout<<"No"<<endl;
	exit(0);
}
int main(){
	long long x,a,y,b;
	cin>>x>>a>>y>>b;
	
	auto X = get(x);
	auto Y = get(y);
	for(auto &t:X){
		t.second *= a;
	}
	for(auto &t:Y){
		t.second *= b;
	}
	
	for(auto t:X){
		if(t.second < Y[t.first])NG();
	}
	for(auto t:Y){
		if(t.second > X[t.first])NG();
	}
	
	cout<<"Yes"<<endl;
	
	
	return 0;
}
0