結果

問題 No.312 置換処理
コンテスト
ユーザー kuisiba
提出日時 2016-06-03 12:30:11
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 514 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 282 ms
コンパイル使用メモリ 70,400 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-11 21:14:47
合計ジャッジ時間 6,279 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 TLE * 1 -- * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>

using namespace std;

long long func(long long n) {
    long long p;
    if (n == 3) p = n;
    for (int i = 3; i < n; ++i) {
        if (i * i <= n) {
            if (n % i) {
                continue;
            } else {
                p = i;
                break;
            }
        } else {
            break;
        }
    }
    return p;
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    long long n;
    cin >> n;
    cout << func(n) << endl;
    return 0;
}
0