結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
![]() |
提出日時 | 2016-06-09 12:24:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 495 bytes |
コンパイル時間 | 531 ms |
コンパイル使用メモリ | 60,740 KB |
実行使用メモリ | 13,024 KB |
最終ジャッジ日時 | 2024-10-09 06:14:36 |
合計ジャッジ時間 | 3,913 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 8 WA * 1 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(c<=2) cout<<"NO"<<endl; else cout<<"YES"<<endl; }