結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nenuon
                         | 
                    
| 提出日時 | 2017-07-08 00:14:28 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 12 ms / 1,000 ms | 
| コード長 | 618 bytes | 
| コンパイル時間 | 738 ms | 
| コンパイル使用メモリ | 88,632 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-06 10:10:31 | 
| 合計ジャッジ時間 | 2,059 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 43 | 
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
int main(){
  ll x; cin >> x;
  ll y = 1;
  for(ll p = 2; p * p <= x + 1; p++){
    if(x % p != 0) continue;
    int cnt = 0;
    while(x % p == 0){
      x /= p;
      cnt++;
    }
    if(cnt % 2 == 1) y *= p;
  }
  if(x > 0) y *= x;
  printf("%lld\n", y);
  return 0;
}
            
            
            
        
            
nenuon