結果

問題 No.36 素数が嫌い!
ユーザー metasequo
提出日時 2015-05-30 21:54:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 302 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 60,084 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 12:47:30
合計ジャッジ時間 1,483 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <math.h>
using namespace std;
int main(){
	long long n;
	bool ans = true;
	cin >> n;
	if(n != 1 && n != 2){
		for(int i=2; i<sqrt(n); i++){
			if(n % i == 0){
				ans = false;
				break;
			}
		}
	}else{
		if(n == 2) ans = false;
	}
	cout << (ans ? "NO" : "YES") << endl;
}
0