結果

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

ソースコード

diff #

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

typedef long long ll;

signed main(){
  ll X; cin >> X;
  ll Y = 1LL;
  ll x = X;
  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; 
    }
    if( x % ( X / i ) == 0 ){
      int cnt  =0;
      while( x and x % ( X / i ) == 0 )
        ++cnt, x /= i;
      if( cnt & 1 )
        Y *= i;
    }
  }
  cout << Y * x << endl;
  return 0;
}
0