結果

問題 No.3233 順列判定
ユーザー Taiki0715
提出日時 2025-08-30 17:08:46
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 413 bytes
コンパイル時間 808 ms
コンパイル使用メモリ 80,436 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-30 17:08:49
合計ジャッジ時間 2,616 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<numeric>
using namespace std;
int main(){
  long long n,m;
  cin>>n>>m;
  if(m==1){
    cout<<"Yes\n";
    return 0;
  }
  long long n2=n;
  long long tot=n;
  for(long long i=2;i*i<=n2;i++)if(n2%i==0){
    n2/=i;
    if(n2%i==0){
      cout<<"No\n";
      return 0;
    }
    tot=tot/i*(i-1);
  }
  if(n2!=1)tot=tot/n2*(n2-1);
  if(gcd(m,tot)==1)cout<<"Yes\n";
  else cout<<"No\n";
}
0