結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-11 15:50:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 471 bytes |
| コンパイル時間 | 1,625 ms |
| コンパイル使用メモリ | 169,448 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-01 07:59:42 |
| 合計ジャッジ時間 | 4,860 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 13 WA * 13 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
const int nmax=10000001;
typedef long long ll;
int main(){
vector<bool> p(nmax+1,true);
p[0]=false;
p[1]=false;
for(int i=2;i*i<=nmax;i++){
if(p[i]){
for(int j=2;j*i<=nmax;j++){
p[i*j]=false;
}
}
}
ll n;cin >> n;
for(ll i=2;i*i<=n;i++){
if(!p[i]&&n%i==0){
cout << "YES" << endl;
}
}
cout << "NO" << endl;
}