結果

問題 No.3023 素数判定するだけ
ユーザー みしあみしあ
提出日時 2021-10-22 12:47:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,321 bytes
コンパイル時間 754 ms
コンパイル使用メモリ 76,956 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-23 20:53:06
合計ジャッジ時間 6,142 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <utility>
#include <vector>
#include <numeric>
using namespace std;

using ll = long long;

const ll t = true, f = false, tt = t << t;

ll ad(ll a, ll b){
    vector<ll> tmp{a};
    return accumulate(tmp.begin(), tmp.end(), b);
}

ll mn(ll a, ll b){
    return ad(a, ad(~b, t));
}

template<class... Args>
ll Num(Args... args){
    ll ret = f;
    for(auto v : initializer_list<ll>{args...}){
        ret <<= t;
        ret |= v;
    }
    return ret;
}

ll mm(ll a, ll b){
    ll ret = f;
    if(a>b){
        swap(a, b);
    }
    while(a){
        if(a&t){
            ret = ad(ret, b);
        }
        b <<= t;
        a >>= t;
    }
    return ret;
}

ll pp(ll a, ll b){
    ll x = ad(a, b);
    return x;
}

bool isp(ll N){
    vector<bool> XS(N<<t, true);
    XS[f] = XS[t] = f;
    for(int i=tt; i<N; i=ad(i, t)){
        if(!XS[i]) continue;
        ll c = i;
        for(ll c = i<<t; c <= N; c = ad(c, i)){
            XS[c] = f;
        }
    }
    return XS[N];
}

int main(){
    ll N;
    cin >> N;
    if(isp(N)){
        cout << (char)Num(t,f,t,t,f,f,t);
        cout << (char)Num(t,f,f,f,t,f,t);
        cout << (char)Num(t,f,t,f,f,t,t);
    }else{
        cout << (char)Num(t,f,f,t,t,t,f);
        cout << (char)Num(t,f,f,t,t,t,t);
    }
    cout << endl;
    return f;
}
0