結果
| 問題 | 
                            No.36 素数が嫌い!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-05-19 22:30:35 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 873 bytes | 
| コンパイル時間 | 1,554 ms | 
| コンパイル使用メモリ | 159,640 KB | 
| 実行使用メモリ | 13,240 KB | 
| 最終ジャッジ日時 | 2024-10-06 11:01:35 | 
| 合計ジャッジ時間 | 9,972 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 8 RE * 18 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int N=10000000;
bool p[N+1];
bool valid(ll x)
{
    fill(p,p+N+1,true);
    p[0]=p[1]=false;
    for(ll i=2; i<=N; ++i)
    {
        if(p[i]) for(ll j=2; i*j<=N; ++j) p[i*j]=false;
    }
    for(ll i=2; i*i<=x; ++i)
    {
        if(x%i==0)
        {
            if(!p[i]) return true;
            else
            {
                if(!p[x/i]) return true;
            }
        }
    }
    return false;
}
int main()
{
    ll n;
    cin >>n;
    string ans="NO";
    if(valid(n)) ans="YES";
    std::cout << ans << std::endl;
    return 0;
}