結果

問題 No.300 平方数
ユーザー kkslucy1
提出日時 2018-03-13 03:14:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 344 bytes
コンパイル時間 1,208 ms
コンパイル使用メモリ 157,404 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 03:16:29
合計ジャッジ時間 2,636 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ll x;
	cin >> x;
	ll ans = 1;
	for (ll i = 2;i*i <= x;i++) {
		if (x%i == 0) {
			if (ans%i == 0) {
				ans /= i;
			}
			else {
				ans *= i;
			}
			x /= i--;
		}
	}
	if (ans%x == 0) {
		ans /= x;
	}
	else {
		ans *= x;
	}
	cout << ans << endl;
	return 0;


}
0