結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
motxx
|
| 提出日時 | 2014-10-08 01:05:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 626 bytes |
| コンパイル時間 | 1,464 ms |
| コンパイル使用メモリ | 157,276 KB |
| 実行使用メモリ | 101,228 KB |
| 最終ジャッジ日時 | 2024-12-30 08:13:37 |
| 合計ジャッジ時間 | 48,880 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 WA * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define MAX 100000100
bool prime[MAX];
typedef unsigned long long ull;
void sieve() {
fill(prime, prime+MAX, true);
prime[0] = prime[1] = false;
for(ull i=2 ; i*i<MAX ; i++){
if(prime[i]){
for(ull j=i*i ; j<MAX ; j+=i){
prime[j] = false;
}
}
}
}
int main() {
sieve();
ull N; cin >> N;
if(N == 1) { cout << "NO\n"; return 0; }
int cnt = 0;
for(ull i=2; i*i<=N; i++) {
if(prime[i]) {
cnt ++;
}
}
if(cnt >= 2) cout << "YES\n";
else cout << "NO\n";
return 0;
}
motxx