結果

問題 No.36 素数が嫌い!
ユーザー nemunemu
提出日時 2024-01-13 20:03:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 95 ms / 5,000 ms
コード長 487 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 77,408 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-28 01:44:46
合計ジャッジ時間 1,874 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   20 |     for (auto [key, val]: mp) check += val;
      |               ^

ソースコード

diff #

// 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]++;
    int check = 0;
    for (auto [key, val]: mp) check += val;
    if (check >= 3) cout << "YES" << endl;
    else cout << "NO" << endl;
}
0