結果

問題 No.312 置換処理
ユーザー otsnskotsnsk
提出日時 2015-12-07 19:10:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 992 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 67,960 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 20:07:40
合計ジャッジ時間 2,073 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,348 KB
testcase_01 AC 4 ms
4,348 KB
testcase_02 AC 7 ms
4,348 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 6 ms
4,352 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 6 ms
4,348 KB
testcase_08 AC 5 ms
4,352 KB
testcase_09 AC 3 ms
4,352 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 6 ms
4,352 KB
testcase_12 AC 4 ms
4,352 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,348 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,352 KB
testcase_25 AC 1 ms
4,352 KB
testcase_26 AC 1 ms
4,352 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 WA -
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 4 ms
4,348 KB
testcase_34 AC 3 ms
4,352 KB
testcase_35 AC 3 ms
4,348 KB
testcase_36 AC 2 ms
4,352 KB
testcase_37 AC 1 ms
4,348 KB
testcase_38 WA -
testcase_39 AC 3 ms
4,348 KB
testcase_40 AC 1 ms
4,348 KB
testcase_41 AC 1 ms
4,348 KB
testcase_42 AC 2 ms
4,348 KB
testcase_43 AC 1 ms
4,352 KB
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

#define FORR(i,b,e) for(int i=(b);i<(int)(e);++i)
#define FOR(i,e) FORR(i,0,e)
#define ALL(c) begin(c), end(c)
#define dump(var) cerr << #var ": " << var << "\n"
#define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n"

using namespace std;

typedef long long ll;

void factorization(ll n, vector<ll> &factors) {
    ll d = 2;
    while (n % d == 0) {
        n /= d;
        factors.push_back(d);
    }
    ll limit = (ll)sqrt(n) + 1;
    d = 3;
    while (d <= limit) {
        while (n % d == 0) {
            n /= d;
            factors.push_back(d);
        }
        d += 2;
    }
    if (n > 1) factors.push_back(n);
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;
    vector<ll> factors;
    factorization(N, factors);
    
    for (auto &e: factors) {
        if (e > 2) {
            cout << e << endl;
            break;
        }
    }
    return 0;
}
0