結果

問題 No.300 平方数
ユーザー kurenai3110
提出日時 2016-07-05 18:40:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 467 bytes
コンパイル時間 1,002 ms
コンパイル使用メモリ 66,612 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-10-12 20:18:19
合計ジャッジ時間 3,346 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 TLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;

int main() {
	long long int x,n;
	vector<pair<int, int> > ans;
	cin >> x;

	n = 2;
	while (x != 1){
		int cnt = 0;
		while (!(x%n)){
			x = x / n;
			cnt++;
		}
		if (cnt){
			ans.push_back(make_pair(cnt, n));
		}
		n++;
	}

	long long int y=1;
	for (int i = 0; i < ans.size(); i++){
		if (ans[i].first % 2){
			y *= ans[i].second;
		}
	}

	cout << y << endl;

	return 0;
}
0