結果

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

ソースコード

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(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