結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
wonda_t_coffee
|
| 提出日時 | 2020-02-28 20:57:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,154 bytes |
| コンパイル時間 | 729 ms |
| コンパイル使用メモリ | 82,420 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 16:34:18 |
| 合計ジャッジ時間 | 2,097 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 4 |
ソースコード
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define SORT(a) sort((a).begin(), (a).end());
#define UNIQ(a) SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define FIND(a,x) find((a).begin(), (a).end(), (x)) != (a).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using namespace std;
const int MOD = 1000000007; // 10^9 + 7
bool solve(ll n) {
if (n <= 2) return false;
if (n % 2 == 0) return true;
ll lim = (ll)sqrt(n);
vector<int> primes;
for (ll d = 3; d <= lim; d += 2) {
int cnt = 0;
while (n % d == 0) {
cnt++;
n /= d;
}
if (cnt > 1) return true;
if (cnt > 0) primes.push_back(d);
}
if (primes.size() == 0) return false;
if (primes.size() > 1) return true;
return false;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll N; cin >> N;
cout << (solve(N) ? "YES" : "NO") << endl;
}
wonda_t_coffee