結果

問題 No.36 素数が嫌い!
ユーザー kpinkcatkpinkcat
提出日時 2023-10-09 02:13:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 455 bytes
コンパイル時間 994 ms
コンパイル使用メモリ 103,808 KB
実行使用メモリ 589,120 KB
最終ジャッジ日時 2023-10-09 02:13:17
合計ジャッジ時間 9,261 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

int main(){
    ll n;
    cin >> n;
    vector<ll> prime(n+1, 1);
    prime[0] = 0;
    for (int i = 2; i <= pow(n, 0.5); i++){
        for (int j = i+i; j <= n; j += i) prime[j] = 0;
    }
    cout << ((prime[n]) ? "NO" : "YES") << endl;
}
0