結果

問題 No.300 平方数
ユーザー rollman054
提出日時 2015-11-14 10:21:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 15 ms / 1,000 ms
コード長 309 bytes
コンパイル時間 1,508 ms
コンパイル使用メモリ 159,608 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-13 16:42:23
合計ジャッジ時間 2,567 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(void){
  ll x; cin >> x;
  ll ans = 1;
  for(ll i=2; i <= sqrt(x)+10; i++){
    ll cnt = 0;
    while(x%i == 0){
      x /= i;
      cnt++;
    }
    if(cnt%2 == 1){
      ans *= i;
    }
  }
  cout << ans*x << endl;
  return 0;
}
0