結果

問題 No.300 平方数
ユーザー 0w1
提出日時 2016-11-20 20:58:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 1,528 ms
コンパイル使用メモリ 167,564 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-27 09:06:12
合計ジャッジ時間 3,093 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;

signed main(){
  ll X; cin >> X;
  int np = 0;
  for( int i = 2; 1LL * i * i <= X; ++i )
    np |= X % i == 0;
  if( not np )
    cout << X << endl, exit( 0 );
  ll Y = 1LL;
  for( int i = 2; 1LL * i * i <= X; ++i ){
    if( X % i == 0 ){
      int cnt = 0;
      while( X and X % i == 0 )
        ++cnt, X /= i;
      if( cnt & 1 )
        Y *= i; 
    }
  }
  cout << Y << endl;
  return 0;
}
0