結果
| 問題 | No.2 素因数ゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-06-14 23:04:29 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,596 bytes | 
| コンパイル時間 | 3,744 ms | 
| コンパイル使用メモリ | 233,204 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-25 03:43:14 | 
| 合計ジャッジ時間 | 4,738 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 31 | 
ソースコード
#include <bits/stdc++.h>
//#include <iostream>
#include <atcoder/all>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
using namespace atcoder;
typedef long long ll;
const int MOD = 1000000007;
//const int MOD =  998244353;
 
const ll INF = 1LL<<61;
const int IINF = 1000000000;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<int, int> PI;
//typedef pair<ll, ll> P;
using mint = modint1000000007;
typedef pair<ll, ll> P;
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数
        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        // その結果を push
        res.push_back({a, ex});
    }
    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;  cin >> N;
    vector<P> primes = prime_factorize(N);
    vector<ll> nim;
    for(auto prime : primes){
        nim.push_back(prime.second);
    }
    ll xor_sum = 0;
    for(auto n : nim){
        xor_sum ^= n;
    }
    if (xor_sum == 0){
        cout << "Bob" << endl;
    }
    else{
        cout << "Alice" << endl;
    }
}
            
            
            
        