結果

問題 No.36 素数が嫌い!
ユーザー metasequometasequo
提出日時 2015-05-30 22:12:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 59,568 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-20 17:50:06
合計ジャッジ時間 12,977 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 OLE -
testcase_12 OLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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