結果

問題 No.36 素数が嫌い!
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-06-09 12:24:27
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 495 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 60,020 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-04-17 12:12:45
合計ジャッジ時間 3,875 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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; 
}
0