結果

問題 No.2 素因数ゲーム
ユーザー rgnerdplayer
提出日時 2024-02-14 02:11:58
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 2,787 ms
コンパイル使用メモリ 244,492 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-28 18:42:12
合計ジャッジ時間 3,241 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    auto solve = [&]() {
        int n;
        cin >> n;

        int res = 0;

        for (int i = 2; i * i <= n; i++) {
            int c = 0;
            while (n % i == 0) {
                c++;
                n /= i;
            }
            res ^= c;
        }

        if (n > 1) {
            res ^= 1;
        }

        cout << (res != 0 ? "Alice" : "Bob") << '\n';
    };
    
    solve();
    
    return 0;
}
0