結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kurenai3110
                         | 
                    
| 提出日時 | 2016-07-06 02:05:37 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 7 ms / 1,000 ms | 
| コード長 | 424 bytes | 
| コンパイル時間 | 524 ms | 
| コンパイル使用メモリ | 61,044 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-12 20:25:02 | 
| 合計ジャッジ時間 | 1,737 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 43 | 
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int main(){
	long long int x;
	long long int y = 1;
	cin >> x;
	int cnt = 0;
	while (!(x%2)) {
		x = x / 2;
		cnt++;
	}
	if (cnt % 2) {
		y *= 2;
	}
	for (long long int i = 3; i*i <= x; i += 2)
	{
		cnt = 0;
		while (!(x%i)) {
			x = x / i;
			cnt++;
		}
		if (cnt % 2) {
			y *= i;
		}
	}
	cout << y*x << endl;
	return 0;
}
            
            
            
        
            
kurenai3110