結果

問題 No.36 素数が嫌い!
ユーザー rodearodea
提出日時 2018-01-15 22:58:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 64,156 KB
実行使用メモリ 7,668 KB
最終ジャッジ日時 2023-08-25 17:58:11
合計ジャッジ時間 4,124 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
7,460 KB
testcase_01 WA -
testcase_02 AC 102 ms
7,436 KB
testcase_03 AC 102 ms
7,424 KB
testcase_04 AC 103 ms
7,476 KB
testcase_05 AC 102 ms
7,416 KB
testcase_06 AC 102 ms
7,416 KB
testcase_07 AC 103 ms
7,428 KB
testcase_08 AC 20 ms
7,452 KB
testcase_09 AC 20 ms
7,436 KB
testcase_10 AC 20 ms
7,416 KB
testcase_11 AC 102 ms
7,440 KB
testcase_12 AC 103 ms
7,464 KB
testcase_13 AC 102 ms
7,468 KB
testcase_14 WA -
testcase_15 AC 20 ms
7,420 KB
testcase_16 AC 102 ms
7,512 KB
testcase_17 AC 102 ms
7,432 KB
testcase_18 AC 20 ms
7,412 KB
testcase_19 AC 20 ms
7,392 KB
testcase_20 WA -
testcase_21 AC 20 ms
7,492 KB
testcase_22 AC 20 ms
7,408 KB
testcase_23 AC 20 ms
7,404 KB
testcase_24 WA -
testcase_25 AC 19 ms
7,464 KB
testcase_26 AC 102 ms
7,416 KB
testcase_27 AC 103 ms
7,436 KB
testcase_28 AC 103 ms
7,468 KB
testcase_29 AC 104 ms
7,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

long long int prime[100000000];

void eratosthenes()
{
	int i, j;

	for (i = 2; i <= 500000; i++)
	{
		for (j = 2; i*j <= 500000; j++)
		{
			prime[i*j] = 1;
		}
	}
}

int main()
{
	long long n;

	cin >> n;

	eratosthenes();

	for (int i = 2; i < 100000000; i++)
	{
		if (prime[i] == 1)
		{
			if (n%i == 0 && n != i)
			{
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
}
0