結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             RIGIH
                         | 
                    
| 提出日時 | 2017-07-19 16:34:19 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 583 bytes | 
| コンパイル時間 | 688 ms | 
| コンパイル使用メモリ | 64,040 KB | 
| 実行使用メモリ | 10,496 KB | 
| 最終ジャッジ日時 | 2024-10-08 14:26:10 | 
| 合計ジャッジ時間 | 3,481 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 TLE * 1 -- * 25 | 
ソースコード
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define LL long long
#define mass 1000000007
using namespace std;
int main(){
	ll x;
	cin>>x;
	ll y=1;
	int d=0;
	do{
		d=0;
		if(x%2==0){
			x/=2;
			if(y%2==0){
				y/=2;
			}else{
				y*=2;
			}
			d=1;
		}
	}while(d);
	for(ll i=3;x>1;i+=2){
		if(x%i==0){
			x/=i;
			if(y%i==0){
				y/=i;
			}else{
				y*=i;
			}
			i-=2;
		}
	}
	cout<<y<<endl;
	return 0;
	
}
            
            
            
        
            
RIGIH