結果

問題 No.36 素数が嫌い!
ユーザー kpinkcatkpinkcat
提出日時 2023-10-09 02:37:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 587 bytes
コンパイル時間 1,321 ms
コンパイル使用メモリ 104,088 KB
実行使用メモリ 584,812 KB
最終ジャッジ日時 2023-10-09 02:37:07
合計ジャッジ時間 6,126 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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, tmp;
    cin >> n;
    tmp = pow(n, 0.5);
    vector<ll> prime(n+1, 1);
    prime[0] = 0;
    for (int i = 2; i < n; i++){
        if (prime[i]){
            for (int j = i+i; j <= n; j += i) prime[j] = 0;
        } else if (!(n%i)){
                    cout << "YES" << endl;
                    return 0;
        }
    }
    cout << "NO" << endl;
}
0