結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-10-11 21:49:54 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 13 ms / 1,000 ms | 
| コード長 | 302 bytes | 
| コンパイル時間 | 1,638 ms | 
| コンパイル使用メモリ | 165,700 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-11 21:49:58 | 
| 合計ジャッジ時間 | 3,505 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 43 | 
ソースコード
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x, cnt, s, y;
int main()
{
	scanf("%lld", &x);
	s = sqrt(x);
	y = 1;
	for (ll i = 2; i <= s; i++)
	{
		cnt = 0;
		while (x % i == 0) cnt++, x /= i;
		if (cnt & 1) y *= i;
	}
	if (x > 1) y *= x;
	printf("%lld\n", y);
	return 0;
}