結果

問題 No.300 平方数
ユーザー E31415926
提出日時 2016-03-31 16:24:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 350 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 59,144 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-02 08:29:43
合計ジャッジ時間 1,873 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<math.h>
using namespace std;

int main()
{
	long long x, y = 1, n = 0, i;
	cin >> x;
	while (x % 2 == 0) {
		x /= 2;
		n++;
	}
	if (n % 2 != 0) {
		y *= 2;
	}

	for (i = 3; i <= sqrt(x); i += 2) {
		n = 0;
		while (x % i == 0) {
			x /= i;
			n++;
		}
		if (n % 2 != 0) {
			y *= i;
		}
	}
	cout << y << endl;
	return 0;
}
0