結果

問題 No.36 素数が嫌い!
ユーザー atn112323atn112323
提出日時 2016-05-08 13:18:54
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 692 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 55,624 KB
実行使用メモリ 10,148 KB
最終ジャッジ日時 2024-04-27 15:15:35
合計ジャッジ時間 7,493 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>

using namespace std;

long long N;

int main() {
	cin >> N;
	for (long long d = 2; d * d <= N; d++) {
		int cnt = 0;
		while (N % d == 0) {
			cnt++;
			N /= d;
		}
		if (cnt > 0) {
			if (cnt > 2) {
				cout << "YES" << endl;
			} else if (cnt == 2) {
				if (N > 1) {
					cout << "YES" << endl;
				} else {
					cout << "NO" << endl;
				}
			} else if (cnt == 1) {
				bool is_prime = true;
				for (int dd = d + 1; dd * dd <= N; dd++) {
					if (N % dd == 0) {
						is_prime = false;
						break;
					}
				}
				if (is_prime) {
					cout << "NO" << endl;
				} else {
					cout << "YES" << endl;
				}
			}
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}
0