結果

問題 No.2 素因数ゲーム
ユーザー pop_o
提出日時 2024-08-30 14:54:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 467 bytes
コンパイル時間 2,443 ms
コンパイル使用メモリ 166,940 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-08-30 14:54:22
合計ジャッジ時間 3,041 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    long long n;
    cin >> n;
    long long ans = 0;
    for (int i = 2; i*i <= n; i++) {
        if (n % i == 0) {
            int cnt = 0;
            while (n % i == 0 ){
                n /= i;
                cnt++;
            }
            ans ^= cnt;
        }
    }
    if (n != 1) ans ^= 1;
    cout << (ans == 0 ? "Bob\n": "Alice\n");
}
0