結果

問題 No.2 素因数ゲーム
ユーザー izuru_matsuura
提出日時 2016-09-13 21:14:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 1,066 bytes
コンパイル時間 3,054 ms
コンパイル使用メモリ 172,940 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 12:41:56
合計ジャッジ時間 2,768 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

namespace {

    typedef double real;
    typedef long long ll;

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "[]";
        auto i = vs.begin();
        os << "[" << *i;
        for (++i; i != vs.end(); ++i) os << " " << *i;
        return os << "]";
    }
    template<class T> istream& operator>>(istream& is, vector<T>& vs) {
        for (auto it = vs.begin(); it != vs.end(); it++) is >> *it;
        return is;
    }

    ll N;
    void input() {
        cin >> N;
    }

    void factor(ll n, map<ll, int>& m) {
        for (ll i = 2; i * i <= n; i++) {
            while (n % i == 0) {
                m[i]++;
                n /= i;
            }
        }
        if (n != 1) m[n]++;
    }

    void solve() {
        map<ll, int> m; factor(N, m);
        int r = 0;
        for (auto e : m) {
            r ^= e.second;
        }
        cout << (r ? "Alice" : "Bob") << endl;
    }
}

int main() {
    input(); solve();
    return 0;
}

0