結果

問題 No.8023 素数判定するだけ
ユーザー ei1333333
提出日時 2017-03-31 22:33:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 59,372 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-07 04:55:39
合計ジャッジ時間 3,310 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<functional>

using namespace std;

int zero, base;

bool sosu(int idx)
{
  ++base;
  ++base;
  if(idx < base) return (false);
  for(; multiplies< int >{}(base, base) <= idx; base++) {
    if(idx % base == zero) return (false);
  }
  return (true);
}

int main()
{
  int idx;
  cin >> idx;
  cout << (sosu(idx) ? "YES" : "NO") << endl;
}
0