結果

問題 No.2 素因数ゲーム
ユーザー toyon
提出日時 2020-03-22 18:50:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 737 bytes
コンパイル時間 2,332 ms
コンパイル使用メモリ 174,848 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 16:56:11
合計ジャッジ時間 2,772 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;

typedef long long ll;
const int INF = 1e8;
// const ll INF = 1LL << 60;
typedef pair<int, int> P;

int main() {
    ll N;
    cin >> N;

    map<int, int> mp;
    for (int i = 2; i * i <= N; i++) {
        int cnt = 0;
        while (N % i == 0) {
            N /= i;
            cnt++;
        }
        mp[i] = cnt;
    }
    if (N != 1) {
        mp[N] = 1;
    }

    int ans = 0;
    for (auto iter = mp.begin(); iter != mp.end(); iter++) {
       ans ^= iter->second; 
    }
    // cout << ans << endl;
    if (ans != 0) {
        cout << "Alice" << endl;
    } else {
        cout << "Bob" << endl;
    }
}
0