結果

問題 No.36 素数が嫌い!
ユーザー FF256grhyFF256grhy
提出日時 2016-09-04 00:59:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 258 ms / 5,000 ms
コード長 763 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 41,856 KB
最終ジャッジ日時 2023-09-09 07:41:18
合計ジャッジ時間 3,755 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
21,408 KB
testcase_01 AC 153 ms
33,604 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 48 ms
15,228 KB
testcase_12 AC 258 ms
41,836 KB
testcase_13 AC 245 ms
41,728 KB
testcase_14 AC 96 ms
27,520 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 57 ms
19,264 KB
testcase_20 AC 256 ms
41,856 KB
testcase_21 AC 172 ms
33,604 KB
testcase_22 AC 159 ms
33,632 KB
testcase_23 AC 81 ms
21,248 KB
testcase_24 AC 80 ms
23,460 KB
testcase_25 AC 82 ms
23,424 KB
testcase_26 AC 106 ms
27,520 KB
testcase_27 AC 166 ms
35,588 KB
testcase_28 AC 93 ms
25,416 KB
testcase_29 AC 226 ms
39,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>

#define FOR(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define REV(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define INC0(i, n) FOR(i, 0, n)
#define INC1(i, n) FOR(i, 1, (n) + 1)
#define DEC0(i, n) REV(i, 0, n)
#define DEC1(i, n) REV(i, 1, (n) + 1)

typedef long long   signed int LL;
typedef long long unsigned int LU;


LL n;
int comp[10000001];

int main() {
	scanf("%lld", &n);
	
	for(LL i = 2; i * i <= n; i++) {
		if(comp[i] == 0) {
			for(LL j = i * 2; j * j <= n; j += i) {
				comp[j] = 1;
			}
		}
	}
	
	int c = 0;
	LL t = n;
	for(LL i = 2; i * i <= n; i++) {
		if(comp[i] == 0) {
			while(t % i == 0) { t /= i; c++; }
		}
		if(t == 1) { break; }
	}
	
	if(t != 1) { c++; }
	
	printf("%s\n", c > 2 ? "YES" : "NO");
	
	return 0;
}
0