結果

問題 No.1556 Power Equality
ユーザー monnumonnu
提出日時 2021-06-25 22:43:27
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 164,596 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 15:54:08
合計ジャッジ時間 2,183 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 1000000000

int 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;
  }
}
0