結果
問題 | No.1556 Power Equality |
ユーザー |
![]() |
提出日時 | 2021-06-25 22:43:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 1,596 ms |
コンパイル使用メモリ | 166,536 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 09:48:49 |
合計ジャッジ時間 | 2,173 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h>using namespace std;//#include <atcoder/all>//using namespace atcoder;using ll=long long;using Graph=vector<vector<pair<int,pair<int,int>>>>;#define MAX 1000000#define MOD 1000000007#define INF 1000000000int main(){ll A,B;cin>>A>>B;bool flag=true;ll a=A;ll b=B;for(ll i=2;i<=100000;i++){ll cnt1=0;ll cnt2=0;while(a%i==0){a/=i;cnt1++;}while(b%i==0){b/=i;cnt2++;}if(cnt1*B!=cnt2*A){flag=false;}}if(a>1||b>1){if(A!=B){flag=false;}}if(flag==true){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}