結果

問題 No.36 素数が嫌い!
ユーザー kpinkcat
提出日時 2023-10-09 02:37:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 587 bytes
コンパイル時間 907 ms
コンパイル使用メモリ 106,592 KB
最終ジャッジ日時 2025-02-17 06:22:59
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 RE * 22 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

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