結果

問題 No.36 素数が嫌い!
ユーザー troro_kelptroro_kelp
提出日時 2018-10-07 12:07:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,506 bytes
コンパイル時間 730 ms
コンパイル使用メモリ 96,236 KB
実行使用メモリ 13,416 KB
最終ジャッジ日時 2024-04-20 18:12:51
合計ジャッジ時間 4,130 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
13,176 KB
testcase_01 AC 118 ms
13,272 KB
testcase_02 AC 48 ms
13,224 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 48 ms
13,204 KB
testcase_08 AC 49 ms
13,304 KB
testcase_09 AC 48 ms
13,228 KB
testcase_10 AC 48 ms
13,108 KB
testcase_11 AC 77 ms
13,272 KB
testcase_12 AC 138 ms
13,308 KB
testcase_13 WA -
testcase_14 AC 105 ms
13,348 KB
testcase_15 AC 46 ms
13,252 KB
testcase_16 AC 47 ms
13,344 KB
testcase_17 AC 47 ms
13,196 KB
testcase_18 AC 49 ms
13,240 KB
testcase_19 AC 86 ms
13,080 KB
testcase_20 AC 141 ms
13,068 KB
testcase_21 AC 116 ms
13,252 KB
testcase_22 AC 119 ms
13,296 KB
testcase_23 AC 92 ms
13,072 KB
testcase_24 AC 94 ms
13,224 KB
testcase_25 AC 95 ms
13,264 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
#include <sstream>
using namespace std;
const constexpr int INF = 1e9;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
typedef pair<ll, ll> P;
struct Less{
   bool operator()(const pair<string, int>&a, const pair<string, int>&b){
        if(a.first==b.first){
            return a.second < b.second;
        }
       return a.first < b.first;
    }
};
const constexpr ll MOD = 1e9 + 7;


ll extGCD(ll a, ll b, ll& x, ll& y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}
ll GCD(ll a, ll b){
    if(b==0) return a;
    return GCD(b, a%b);
}

bool sieve[10000010];
int main() {
    for(int i=0; i<10000010; ++i) sieve[i] = true;
    sieve[0] = sieve[1] = false;
    for(int i=2; i*i<10000010; ++i){
        if(sieve[i]){
            for(int j=2; i*j<10000010; ++j) sieve[i*j] = false;
        }
    }
    
    ll N; cin >> N;
    bool ok = true;
    for(ll i=2; i*i<=N; ++i){
        if(N%i==0) ok = false;    
    }
    if(ok) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}
0