結果

問題 No.300 平方数
ユーザー LatteIce
提出日時 2015-11-28 18:51:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 443 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 54,952 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 04:57:40
合計ジャッジ時間 1,825 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main()
{
	// input
	long long int input, x;
	cin >> input;
	x = input;

	// solve
	for (long long i = 2; i * i <= x; i++) {
		//cout << "[for]: " << i << endl;
		for (int j = 0; j < input; j++) {
			//cout << "[Next] " << x << " % " << i*i << endl;
			if ((x % (i * i)) == 0) {
				x = x / (i * i);
				//cout << x << endl;
			}
			else {
				break;
			}
		}
	}
	cout << x << endl;
    return 0;
}
0