結果

問題 No.2 素因数ゲーム
ユーザー H3PO4
提出日時 2023-02-10 17:09:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 66,872 KB
最終ジャッジ日時 2025-02-10 11:53:59
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

int isqrt(int n) {
    int x = n;
    int y = (x + 1) / 2;
    while (y < x) {
        x = y;
        y = (x + n / x) / 2;
    }
    return x;
}


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

    int _xor = 0;
    for (int x = 2; x <= isqrt(N); x++) {
        int tmp = 0;
        while (N % x == 0) {
            N /= x;
            tmp += 1;
        }
        _xor ^= tmp;
    }
    std::string ans = (_xor == 0) ? "Bob" : "Alice";
    std::cout << ans << std::endl;
}
0