結果

問題 No.36 素数が嫌い!
ユーザー nmnmnmnmnmnmnm
提出日時 2014-10-08 01:10:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 946 ms
コンパイル使用メモリ 74,992 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 08:07:13
合計ジャッジ時間 2,304 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <string.h>
#include <math.h>
 
using namespace std;

vector<long long> p_decom(long long m){
  vector<long long> v;

  while(m % 2 == 0){
    v.push_back(2);
    m /= 2;
  }

  for(long long i = 3; i * i <= m; i += 2){
    while(m % i == 0){
      v.push_back(i);
      m /= i;
    }
  }

  if(m > 1){
    v.push_back(m);
  }

  return v;
}
 
int main(){
  long long n;
  cin>>n;
  if(n==1){
    cout << "NO" << endl;
    return 0;
  }
  vector<long long> v = p_decom(n);
  set<long long> se(v.begin(),v.end());
  if(v.size() <= 1){
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  return 0;
}
0