結果

問題 No.300 平方数
ユーザー horiesiniti
提出日時 2016-07-19 12:10:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 372 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 57,072 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-15 17:17:59
合計ジャッジ時間 2,103 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;

int main() {
	// your code goes here
	long long int x;
	std::cin>>x;
	if(x==1){
		std::cout<<"1"<<"\n";
	}else{
		long long int ans=1;
		for(long long int i=2;i*i<=x;i++){
			int c=0;
			while(x%i==0){
				x/=i;
				c++;
			}
			if(c%2==1){
				ans*=i;
			}
			
		}
		ans*=x;
		std::cout<<ans<<"\n";
	}
	return 0;
}
0