結果

問題 No.300 平方数
ユーザー femto
提出日時 2016-08-11 23:49:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 919 ms
コンパイル使用メモリ 99,160 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-07 11:09:40
合計ジャッジ時間 2,072 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 34
権限があれば一括ダウンロードができます

ソースコード

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;

	for(ll i = 2; i * i <= 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;
}
0