結果
問題 | No.36 素数が嫌い! |
ユーザー |
![]() |
提出日時 | 2018-11-17 23:36:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 98 ms / 5,000 ms |
コード長 | 540 bytes |
コンパイル時間 | 1,488 ms |
コンパイル使用メモリ | 173,704 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 14:42:44 |
合計ジャッジ時間 | 2,724 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; map<ll, ll> prime_factor(ll n) { map<ll, ll> res; for (ll i = 2; i*i <= n; i++) { while (n%i == 0) { ++res[i]; n /= i; } } if (n != 1) res[n] = 1; return res; } int main() { ll N; cin >> N; bool f=false; map<ll,ll> m; m = prime_factor(N); ll cnt=0; for (auto itr = m.begin(); itr != m.end(); itr++) { //cout << itr->first <<" "<< itr->second << endl; cnt += itr->second; } if(cnt>=3) cout << "YES" << endl; else cout << "NO" << endl; }