結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
|
提出日時 | 2021-07-17 20:19:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 5,000 ms |
コード長 | 630 bytes |
コンパイル時間 | 1,775 ms |
コンパイル使用メモリ | 196,712 KB |
最終ジャッジ日時 | 2025-01-23 03:03:45 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; template <class T> vector<pair<T, int>> prime_factorize(T N) { vector<pair<T, int>> res; for (T i = 2; i * i <= N; i++) { if (N % i != 0) continue; int ex = 0; while (N % i == 0) { ex++; N /= i; } res.push_back({i, ex}); } if (N != 1) res.push_back({N, 1}); return res; } int main() { long long N; cin >> N; auto pf = prime_factorize(N); long long grundy_xor = 0; for (auto [p, ex] : pf) { grundy_xor ^= ex; } if (grundy_xor == 0) { cout << "Bob" << endl; } else { cout << "Alice" << endl; } return 0; }