結果

問題 No.36 素数が嫌い!
ユーザー utouto97utouto97
提出日時 2019-03-16 16:01:51
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 769 bytes
コンパイル時間 1,285 ms
コンパイル使用メモリ 145,352 KB
実行使用メモリ 81,612 KB
最終ジャッジ日時 2023-09-14 15:18:35
合計ジャッジ時間 20,865 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 357 ms
81,044 KB
testcase_03 AC 359 ms
80,852 KB
testcase_04 AC 364 ms
81,048 KB
testcase_05 RE -
testcase_06 AC 366 ms
80,804 KB
testcase_07 AC 353 ms
80,808 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 427 ms
81,112 KB
testcase_12 AC 559 ms
81,128 KB
testcase_13 AC 548 ms
80,852 KB
testcase_14 RE -
testcase_15 AC 361 ms
80,804 KB
testcase_16 AC 357 ms
81,000 KB
testcase_17 AC 358 ms
80,936 KB
testcase_18 AC 367 ms
80,968 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 <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main()
{
  int maxn = 10000010;
  vi p(maxn, 1);
  repi(i, 2, maxn) if(p[i]){
    repi(j, 2, maxn/i){
      p[i*j] = 0;   
    }
  }

  int n;
  cin >> n;

  bool ans = false;
  repi(i, 2, n/i+1){
    if(n%i == 0){
      if(!p[i] or !p[n/i])
        ans = true;
    }
  }

  cout << (ans ? "YES" : "NO") << endl; 

  return 0;
}
0