結果

問題 No.300 平方数
ユーザー femto
提出日時 2016-08-12 00:00:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 1,000 ms
コード長 510 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 98,812 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 11:10:28
合計ジャッジ時間 2,455 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;

	ll n = X;
	for(ll i = 2; i * i <= X; i++) {
		while(n % i == 0) {
			m[i]++;
			n /= i;
		}
	}
	if(n != 1) m[n]++;

	ll Y = 1;
	for(auto p : m) {
		if(p.second % 2) Y *= p.first;
	}

	cout << Y << endl;
}
0