結果

問題 No.36 素数が嫌い!
ユーザー oba
提出日時 2015-01-24 01:31:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 57,588 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2024-06-23 01:11:50
合計ジャッジ時間 10,627 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 5 WA * 6 TLE * 1 -- * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#define REP(a,b,c) for(int a=b; a<(int)c; a++)
using namespace std;

int main(){
  long long int N;
  cin >> N;
  bool flag = true;
  if(N != 1){
	if(N%2 == 0 || N%3 == 0)flag=false;
	else{
	  for(int i=5, j=7; i < N; i+=6, j+=6){
		if(N%i == 0 || N%j == 0){flag=false; break;}
	  }
	}
  }
  string ans = (!flag) ? "YES\n" : "NO\n";
  cout <<  ans;
  return 0;
}
0