結果

問題 No.3023 Utility is Max?
ユーザー lam6er
提出日時 2025-04-16 00:25:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 644 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 67,272 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-16 00:27:09
合計ジャッジ時間 2,055 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main() {
    int N;
    cin >> N;
    string a = "a", aa = "aa";
    int one = a.size(), two = aa.size();
    bool is_prime = true;
    if (N == one) {
        is_prime = false;
    } else {
        for (int i = two; i < N;) {
            if (N % i == 0) {
                is_prime = false;
                break;
            }
            int carry = one;
            while (carry) {
                int next_carry = (i & carry) << one;
                i ^= carry;
                carry = next_carry;
            }
        }
    }
    cout << (is_prime ? "YES" : "NO") << endl;
}
0