結果
| 問題 | 
                            No.36 素数が嫌い!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             dgd1724
                         | 
                    
| 提出日時 | 2016-10-11 04:55:37 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,098 bytes | 
| コンパイル時間 | 1,815 ms | 
| コンパイル使用メモリ | 158,052 KB | 
| 実行使用メモリ | 10,496 KB | 
| 最終ジャッジ日時 | 2024-11-22 01:19:52 | 
| 合計ジャッジ時間 | 77,126 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 14 TLE * 12 | 
ソースコード
#include <bits/stdc++.h>
const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;
const static int	de_MIN = -999999999;
bool Judge_PrimeNumber(const unsigned long long a) {
	if (a < 2) { return false; }
	if (a == 2) { return true; }
	if (a % 2 == 0) { return false; }
	for (int i = 3; i <= a / i; i += 2) {
		if (a%i == 0) {
			return false;
		}
	}
	return true;
}
int main(void) {
	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());
	unsigned long long N = 0;
	std::cin >> N;
	bool flg = false;
	if (N % 2 == 0) {
		if (N >= 8) {
			for (int i = 4; i <= N / (i-2); i += 2) {
				if (N%i == 0) {
					flg = true;
					break;
				}
			}
		}
	}
	else {
		if (N >= 27) {
			unsigned long long i = 3;
			while (i*3 <= N / i) {
				unsigned long long j = 3;
				while ((i*j) <= N / i) {
					if (N % (i*j) == 0) {
						flg = true;
						break;
					}
					j += 2;
				}
				if (flg) { break; }
				i += 2;
			}
		}
	}
	if (flg) {
		std::cout << "YES" << std::endl;
	}
	else {
		std::cout << "NO" << std::endl;
	}
}
            
            
            
        
            
dgd1724