結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-05 08:58:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 540 bytes |
| コンパイル時間 | 678 ms |
| コンパイル使用メモリ | 59,312 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-10-04 01:17:50 |
| 合計ジャッジ時間 | 7,029 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 1 TLE * 1 -- * 24 |
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
bool isPrime(long long int n){
long long int m = sqrt(n) + 1;
if(n==1)return false;
if(n==2)return true;
if(n%2==0)return false;
for(long long int i=3;i<m;i+=2){
if(n%i == 0)return false;
}
return true;
}
int main() {
long long int n;
long long int d;
int count;
cin>>n;
d = 2;
count = 0;
while(n!=1){
if(isPrime(n)){
++count;
break;
}
if(n%d == 0){
n /= d;
++count;
}else{
++d;
}
}
cout << (count>=3?"YES":"NO") << endl;
return 0;
}