結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             femto
                         | 
                    
| 提出日時 | 2016-08-11 23:49:05 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 483 bytes | 
| コンパイル時間 | 1,930 ms | 
| コンパイル使用メモリ | 99,064 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-07 11:09:38 | 
| 合計ジャッジ時間 | 2,231 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 WA * 34 | 
ソースコード
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll X;
	cin >> X;
	map<ll, int> m;
	for(ll i = 2; i <= ll(sqrt(X)); i++) {
		while(X % i == 0) {
			m[i]++;
			X /= i;
		}
	}
	ll Y = 1;
	for(auto p : m) {
		if(p.second % 2) Y *= p.first;
	}
	cout << Y << endl;
}
            
            
            
        
            
femto