結果

問題 No.1224 I hate Sqrt Inequality
ユーザー hgotohgoto
提出日時 2020-10-28 15:32:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 731 bytes
コンパイル時間 2,484 ms
コンパイル使用メモリ 200,788 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 03:40:02
合計ジャッジ時間 3,498 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

vector<pair<long long, long long>> factor(long long n) {
  vector<pair<long long, long long>> res;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      long long ex = 0;
      while (n % i == 0) {
        ex++;
        n /= i;
      }
      res.push_back({i, ex});
    }
  }
  if (n != 1) res.push_back({n, 1});
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  cin >> a >> b;
  while (gcd(a, b) != 1) {
    a /= gcd(a, b);
    b /= gcd(a, b);
  }
  auto f = factor(b);
  for (auto&& [n, ex] : f) {
    if (n != 2 && n != 5) {
      cout << "Yes" << '\n';
      return 0;
    }
  }
  cout << "No" << '\n';
  return 0;
}
0