結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
focus
|
| 提出日時 | 2018-06-18 01:10:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 470 bytes |
| コンパイル時間 | 659 ms |
| コンパイル使用メモリ | 76,288 KB |
| 実行使用メモリ | 534,428 KB |
| 最終ジャッジ日時 | 2024-06-30 16:42:35 |
| 合計ジャッジ時間 | 13,142 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | MLE * 1 -- * 25 |
ソースコード
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
vector<bool> arr;
long long N;
void Eratosthenes(){
for(int i = 0; i <= N/4; i++){
arr.push_back(1);
}
for(int i = 2; i < sqrt(N); i++){
if(arr[i]){
for(int j = 0; i * (j + 2) <= N/4; j++){
arr[i *(j + 2)] = 0;
}
}
}
}
int main(){
cin >> N;
Eratosthenes();
for(int i=4;i<=N/4;i++){
if(!arr[i]&&N%i==0){
cout << "YES\n";
return 0;
}
}
cout << "NO\n";
return 0;
}
focus