結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
![]() |
提出日時 | 2014-10-08 01:08:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 666 bytes |
コンパイル時間 | 1,925 ms |
コンパイル使用メモリ | 157,408 KB |
実行使用メモリ | 13,184 KB |
最終ジャッジ日時 | 2024-12-30 08:04:56 |
合計ジャッジ時間 | 4,872 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define MAX 10000010 bool prime[MAX]; typedef unsigned long long ull; void sieve() { fill(prime, prime+MAX, true); prime[0] = prime[1] = false; for(ull i=2 ; i*i<MAX ; i++){ if(prime[i]){ for(ull j=i*i ; j<MAX ; j+=i){ prime[j] = false; } } } } int main() { sieve(); ull N; cin >> N; if(N == 1) { cout << "NO\n"; return 0; } int cnt = 0; for(ull i=2; i*i<=N; i++) { if(prime[i]) { while(N % i == 0) { N /= i; cnt ++; } } } if(cnt >= 2) cout << "YES\n"; else cout << "NO\n"; return 0; }