結果

問題 No.312 置換処理
ユーザー hkr
提出日時 2017-02-16 13:40:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 391 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 59,232 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 00:11:28
合計ジャッジ時間 1,769 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for(int i=3;i<sqrt(n);i++) {
        if(n%i==0) {
            ans = i;
            break;
        }
    }
    if(ans == 0 && n%2 == 0)
        cout << n/2 << endl;
    else if(ans == 0)
        cout << n << endl;
    else
        cout << ans << endl;
}
0