結果

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)

bool solve() {
    ll X; cin >> X;
    map<int, int> factors;
    for(ll i = 2; X > 1;) {
        if( X % i == 0) {
            X /= i;
            factors[i] += 1;
        }
        else i++;
    }
    ll Y = 1;
    for(auto p : factors) {
        if(p.second % 2 == 1) Y *= p.first;
    }
    cout << Y << endl;
    return false;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(solve());
    return 0;
}
0