結果

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

ソースコード

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

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

	cout << Y << endl;
}
0