結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-13 19:59:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 5,000 ms |
| コード長 | 676 bytes |
| コンパイル時間 | 699 ms |
| コンパイル使用メモリ | 77,996 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-28 01:44:37 |
| 合計ジャッジ時間 | 1,800 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
// No.36 素数が嫌い!
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
int main() {
ll N;
cin >> N;
map<int, int> mp;
for (int i = 2; (ll)i * i <= N; ++i) {
if (N % i) continue;
while (N % i == 0) {
N /= i;
mp[i]++;
}
}
if (N != 1) mp[N]++;
bool judge = false;
if (mp.size() > 2) judge = true;
else if (mp.size() == 2){
if (mp.begin()->second > 1 || mp.rbegin()->second > 1) judge = true;
} else if (mp.size() == 1) {
if (mp.begin()->second > 2) judge = true;
}
if (judge) cout << "YES" << endl;
else cout << "NO" << endl;
}