結果

問題 No.36 素数が嫌い!
ユーザー DialBird
提出日時 2016-11-28 19:39:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 58,844 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 12:44:44
合計ジャッジ時間 1,721 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 15 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>

using namespace std;

#define REP(i,first,last) for(int i=first;i<last;i++)

bool check(int n){
  int i = 2;
  int count = 0;
  while (n != 1 && i <= sqrt(n)) {
    if (n % i == 0) {
      count++;
      if (count == 3) return true;
      n /= i;
    } else {
      i++;
    }
  }
  return false;
}

int main(){
  int n;
  cin >> n;
  if (check(n)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
0