結果

問題 No.3023 Utility is Max?
ユーザー gew1fw
提出日時 2025-06-12 18:43:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 544 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 66,688 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-12 18:43:37
合計ジャッジ時間 2,063 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main() {
    int N;
    cin >> N;

    if (N < string("aa").size()) {
        cout << "NO" << endl;
        exit(EXIT_SUCCESS);
    }

    string s = "aa";
    bool is_prime = true;
    while (s.size() < N) {
        if (N % s.size() == 0) {
            is_prime = false;
            break;
        }
        s.append(1, 'a');
    }

    if (is_prime) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    exit(EXIT_SUCCESS);
}
0