結果

問題 No.312 置換処理
ユーザー ignis_fatuusignis_fatuus
提出日時 2015-12-17 04:57:21
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 682 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 75,468 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2023-10-14 12:15:34
合計ジャッジ時間 3,475 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
10,624 KB
testcase_01 WA -
testcase_02 AC 15 ms
10,720 KB
testcase_03 WA -
testcase_04 AC 16 ms
10,672 KB
testcase_05 AC 15 ms
10,600 KB
testcase_06 AC 14 ms
10,728 KB
testcase_07 AC 15 ms
10,636 KB
testcase_08 AC 15 ms
10,548 KB
testcase_09 AC 15 ms
10,684 KB
testcase_10 AC 14 ms
10,604 KB
testcase_11 AC 14 ms
10,592 KB
testcase_12 AC 14 ms
10,544 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 15 ms
10,496 KB
testcase_23 AC 15 ms
10,596 KB
testcase_24 AC 15 ms
10,552 KB
testcase_25 AC 15 ms
10,836 KB
testcase_26 AC 15 ms
10,620 KB
testcase_27 WA -
testcase_28 AC 15 ms
10,696 KB
testcase_29 AC 14 ms
10,592 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 15 ms
10,668 KB
testcase_33 AC 16 ms
10,592 KB
testcase_34 AC 15 ms
10,604 KB
testcase_35 AC 15 ms
10,492 KB
testcase_36 AC 14 ms
10,664 KB
testcase_37 AC 15 ms
10,620 KB
testcase_38 WA -
testcase_39 AC 14 ms
10,664 KB
testcase_40 AC 14 ms
10,540 KB
testcase_41 AC 15 ms
10,784 KB
testcase_42 AC 14 ms
10,728 KB
testcase_43 AC 14 ms
10,596 KB
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<memory>
using namespace std;
using Long=long long int;

std::vector<Long> genprimes(Long N) {
    std::vector<Long> p(N);
    for(Long i=2;i<N;++i) p[i]=i;
    for(Long i=2;i<sqrt(N);++i) {
        if(p[i]) {
            for(Long j=2*i;j<N;j+=i) {
                p[j]=0;
            }
        }
    }
    p.erase(remove(p.begin(),p.end(),0),p.end());
    return p;
}

int main() {
    auto primes = genprimes(Long(1e6));
    Long N;cin>>N;
    for(auto x : primes) {
        if(x==2) continue;
        if(N%x==0) {
            cout<<x<<endl;
            return 0;
        }
    }
    cout<<N<<endl;
}
0