結果

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

ソースコード

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]++;
    bool judge = false;
    if (mp.size() > 2) judge = true;
    else {
        for (auto [key, val]: mp) {
            if (val > 1) judge = true;
        }
    }
    if (judge) cout << "YES" << endl;
    else cout << "NO" << endl;
}
0