結果

問題 No.2 素因数ゲーム
ユーザー 👑 Nachia
提出日時 2020-09-27 11:25:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 654 bytes
コンパイル時間 1,606 ms
コンパイル使用メモリ 172,048 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 11:50:26
合計ジャッジ時間 2,702 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

vector<pair<ULL, ULL>> factorize(ULL N) {
    vector<pair<ULL, ULL>> res;
    for (ULL i = 2; i * i <= N; i++) {
        if (N % i) continue;
        res.push_back({ i,0 });
        while (N % i == 0) { N /= i; res.back().second++; }
    }
    if (N != 1) res.push_back({ N,1 });
    return move(res);
}

int main() {
    ULL N; cin >> N;
    auto P = factorize(N);
    ULL ans = 0;
    for (auto p : P) ans ^= p.second;
    if (ans == 0) cout << "Bob" << endl;
    else cout << "Alice" << endl;

    return 0;
}
0