結果
| 問題 |
No.1556 Power Equality
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2024-08-07 20:29:25 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 731 bytes |
| コンパイル時間 | 1,321 ms |
| コンパイル使用メモリ | 102,104 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-08-07 20:29:27 |
| 合計ジャッジ時間 | 2,122 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll a,b;
cin>>a>>b;
auto calc = [](ll a,ll b){
vector<pair<ll,ll>> res;
ll now = a;
for(ll i = 2;i*i<=a;i++) if(now%i==0){
ll cnt = 0;
while(now%i==0){
now /= i;
cnt++;
}
res.push_back(make_pair(i,cnt));
}
if(now!=1) res.push_back(make_pair(now,1));
for(auto&use:res) use.second *= b;
sort(res.begin(),res.end());
return res;
};
if(calc(a,b)==calc(b,a)) cout<<"Yes\n";
else cout<<"No\n";
}
momoyuu