結果
問題 |
No.8023 素数判定するだけ
|
ユーザー |
|
提出日時 | 2017-03-31 23:30:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 779 bytes |
コンパイル時間 | 610 ms |
コンパイル使用メモリ | 76,776 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 06:01:56 |
合計ジャッジ時間 | 3,455 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 25 |
ソースコード
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<string> #include<stack> #include<queue> #include<vector> typedef long long int ll; using namespace std; #define FOR(i,a,b) for (int i=(a);i<=(b);i++) int N,a,b; int zero; int one; std::vector<int> SOSU; int main(){ ios_base::sync_with_stdio(false); one++; cin>>N; if(N==one){ cout<<"NO"<<endl; return zero; } one++; FOR(i,one,N){ if(!(SOSU.size())){ SOSU.push_back(i); continue; } for(auto x:SOSU){ if(!(i%x))break; else if(x==SOSU.back())SOSU.push_back(i); } } if(SOSU.back()==N)cout<<"YES"<<endl; else cout<<"NO"<<endl; }