結果

問題 No.36 素数が嫌い!
ユーザー matsukin1111matsukin1111
提出日時 2019-04-03 23:00:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 5,000 ms
コード長 1,293 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 00:12:42
合計ジャッジ時間 3,540 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
4,376 KB
testcase_01 AC 82 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 34 ms
4,380 KB
testcase_12 AC 101 ms
4,380 KB
testcase_13 AC 101 ms
4,380 KB
testcase_14 AC 64 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 44 ms
4,384 KB
testcase_20 AC 105 ms
4,376 KB
testcase_21 AC 91 ms
4,376 KB
testcase_22 AC 81 ms
4,376 KB
testcase_23 AC 49 ms
4,376 KB
testcase_24 AC 69 ms
4,376 KB
testcase_25 AC 70 ms
4,376 KB
testcase_26 AC 97 ms
4,380 KB
testcase_27 AC 89 ms
4,376 KB
testcase_28 AC 95 ms
4,380 KB
testcase_29 AC 99 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #



#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };


ll p;
vector<ll>dev;

bool prime(ll n) {
	if (n == 1) {
		return false;
	}
	for (ll i = 2; i*i <= n; i++) {
		if (n%i == 0) {
			return false;
		}
	}
	return true;
}


void devisor(ll n) {
	for (ll i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			if (i == n / i) {
				dev.push_back(i);
			}
			else {
				dev.push_back(i);
				dev.push_back(n / i);
			}
		}
	}
}

int main(){
	ll n;
	cin >> n;
	devisor(n);

	int ok = 0;
	rep(i, 0, dev.size()) {
		if (dev[i] != 1 && dev[i] != n) {
			if (!prime(dev[i]))ok = 1;
		}
	}

	if (ok)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}
0