結果

問題 No.36 素数が嫌い!
ユーザー FF256grhyFF256grhy
提出日時 2016-09-04 00:57:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 40,088 KB
最終ジャッジ日時 2024-04-27 16:11:16
合計ジャッジ時間 2,878 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 124 ms
30,968 KB
testcase_02 AC 0 ms
6,944 KB
testcase_03 AC 0 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 WA -
testcase_11 AC 35 ms
13,736 KB
testcase_12 AC 196 ms
39,048 KB
testcase_13 AC 199 ms
39,008 KB
testcase_14 AC 74 ms
26,112 KB
testcase_15 AC 0 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 0 ms
6,944 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 55 ms
22,072 KB
testcase_25 WA -
testcase_26 AC 78 ms
24,776 KB
testcase_27 AC 155 ms
34,548 KB
testcase_28 AC 84 ms
25,108 KB
testcase_29 AC 200 ms
38,436 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%lld", &n);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

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; }
	}
	
	printf("%s\n", c > 2 ? "YES" : "NO");
	
	return 0;
}
0