結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
![]() |
提出日時 | 2016-06-09 12:28:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 517 bytes |
コンパイル時間 | 548 ms |
コンパイル使用メモリ | 59,764 KB |
実行使用メモリ | 12,928 KB |
最終ジャッジ日時 | 2024-10-09 06:15:12 |
合計ジャッジ時間 | 4,625 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 9 RE * 17 |
ソースコード
#include<iostream> #include<vector> using namespace std; #define MAX 10000000 bool zaru[MAX+1]; vector<long long> pr; int main(){ long long N; long long c=0; cin>>N; for(int i=2;i*i<=N;i++) zaru[i]=true; for(int i=2;i*i<=N;i++){ if(zaru[i]){ pr.push_back(i); for(int j=i*2;j*j<=N;j+=i) zaru[i]=false; } } for(int i=0;i<pr.size();i++){ while(N%pr[i]==0){ c++; N/=pr[i]; } } if(N!=1) c++; if(c<=2) cout<<"NO"<<endl; else cout<<"YES"<<endl; }