結果

問題 No.312 置換処理
ユーザー legosuke
提出日時 2021-08-08 02:35:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 1,959 ms
コンパイル使用メモリ 198,428 KB
最終ジャッジ日時 2025-01-23 16:51:01
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

vector<int64_t> divisor(int64_t n) {
    vector<int64_t> res;
    for (int64_t i = 1; i * i <= n; ++i) {
        if (n % i != 0) continue;
        res.push_back(i);
        if (i * i != n) res.push_back(n / i);
    }
    sort(begin(res), end(res));
    return res;
}

int main() {
    int64_t N;
    cin >> N;
    for (auto d : divisor(N)) {
        if (d > 2) {
            cout << d << endl;
            break;
        }
    }
    return 0;
}
0