結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2023-05-19 21:08:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,298 bytes |
コンパイル時間 | 1,133 ms |
コンパイル使用メモリ | 123,324 KB |
最終ジャッジ日時 | 2025-02-13 01:17:53 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <functional> #include <cmath> #include <string> #include <queue> #include <map> #include <bitset> #include <set> #include <stack> #include <numeric> #include <unordered_map> #include <random> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vs = vector<string>; using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using vpii = vector<pii>; using vpll = vector<pll>; using vpdd = vector<pdd>; const int inf = (1 << 30) - 1; const ll INF = 1LL << 60; const int MOD = 1000000007; //const int MOD = 998244353; vector<pll> prime_factorize(ll N) { vector<pll> res; for (ll a = 2; a * a <= N; ++a) { if (N % a != 0) continue; ll ex = 0; while (N % a == 0) { ++ex; N /= a; } res.push_back({ a, ex }); } if (N != 1) res.push_back({ N, 1 }); return res; } int main() { int n; cin >> n; vpll p = prime_factorize(n); int xorall = 0; for (int i = 0; i < p.size(); i++) { xorall ^= p[i].second; } if (xorall == 0) cout << "Bob" << endl; else cout << "Alice" << endl; return 0; }