結果

問題 No.36 素数が嫌い!
ユーザー springroll
提出日時 2018-11-17 23:07:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 368 bytes
コンパイル時間 1,826 ms
コンパイル使用メモリ 165,904 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 14:42:35
合計ジャッジ時間 2,933 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 13 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

bool is_prime(ll n) {
	for (ll i = 2; i*i <= n; i++) {
		if (n%i == 0) return is_prime(i);
	}
	return n != 1;  // 1の場合は例外
}


int main() {
	ll N;
	cin >> N;

	bool f=true;

	//cout << is_prime(N) << endl;
	if(is_prime(N)) f=false;
	if(N==1) f=false;

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

}
0