結果

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

ソースコード

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 ans = 1;
  for (auto [a, b] : pf(N)) if (b == 1) ans *= a;
  cout << ans << "\n";
}
0