結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー ninoinui
提出日時 2020-06-27 10:12:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 201,120 KB
最終ジャッジ日時 2025-01-11 12:38:36
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

map<long, int> pf(long n) {
  map<long, int> ma;
  for (long i = 2; i * i <= n; i++) {
    while (n % i == 0) ma[i]++, n /= i;
  }
  if (n != 1) ma[n]++;
  return ma;
}

int main() {
  int N;
  cin >> N;
  int ans1 = 1, ans2 = 1;
  for (auto [a, b] : pf(N)) (b == 1) ? ans2 *= a : ans1 *= sqrt(pow(a, b));
  cout << ans1 << " " << ans2 << "\n";
}
0