結果

問題 No.300 平方数
ユーザー face4
提出日時 2018-05-05 08:39:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 721 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 67,456 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-28 01:31:31
合計ジャッジ時間 3,290 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 TLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;

int main(){
    ll x;
    cin >> x;
    ll ans = 1;
    
    while(1){
        if(x%2 == 0){
            x /= 2;
            if(x%2 == 0){
                x /= 2;
            }else{
                ans *= 2;
                break;
            }
        }else{
            break;
        }
    }

    ll divisor = 3;
    
    while(divisor <= x){
        if(x%divisor == 0){
            x /= divisor;
            if(x%divisor == 0){
                x /= divisor;
            }else{
                ans *= divisor;                
            }
        }else{
            divisor += 2;
        }
    }

    cout << ans << endl;
    return 0;
}
0