結果

問題 No.312 置換処理
ユーザー kuisiba
提出日時 2016-06-07 09:58:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 55,968 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-08 17:06:51
合計ジャッジ時間 1,728 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

unsigned long long func(unsigned long long n) {
    if (n < 9) {
        if (n != 8) {
            return n;
        } else {
            return 4;
        }
    }
    for (int i = 3; i * i <= n; i += 2) {
        if (n % i == 0) {
            return i;
        }
    }
    return n;
}

int main() {

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

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