結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー a01sa01to
提出日時 2023-09-12 00:03:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 1,670 ms
コンパイル使用メモリ 200,300 KB
最終ジャッジ日時 2025-02-16 21:43:27
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
  #define _GLIBCXX_DEBUG
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  for (int x = 2; x * x <= n; x++) {
    int e = 0;
    while (n % x == 0) {
      e++;
      n /= x;
    }
    if (e > 0) mp[x] = e;
  }
  if (n > 1) mp[n] = 1;
  int a = 1, b = 1;
  for (auto [k, v] : mp) {
    rep(_, v / 2) a *= k;
    if (v % 2 == 1) b *= k;
  }
  cout << a << " " << b << endl;
  return 0;
}
0