結果
| 問題 | No.2 素因数ゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2014-10-27 07:53:24 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 5,000 ms | 
| コード長 | 745 bytes | 
| コンパイル時間 | 652 ms | 
| コンパイル使用メモリ | 62,708 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-26 10:36:28 | 
| 合計ジャッジ時間 | 1,906 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 31 | 
ソースコード
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
// 素因数分解
vector<pair<int,int> > pdecomp(unsigned int n){
    vector<pair<int,int> > res;
    unsigned int e = 0; while(n % 2 == 0){ n /= 2, e++; }
    if(e) res.push_back(make_pair(2,e));
    for(unsigned int p = 3; p*p <= n; p += 2){
        unsigned int e = 0; while(n % p == 0){ n /= p, e++; }
        if(e) res.push_back(make_pair(p,e));
    }
    if(n != 1) res.push_back(make_pair(n,1));
    return res;
}
int main(){
    int N, k = 0;
    cin >> N;
    vector<pair<int,int> > pd = pdecomp(N);
    for(auto &v : pd) k ^= v.second;
    cout << (k?"Alice":"Bob") << endl;
    return 0;
}
            
            
            
        