結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
|
提出日時 | 2023-03-01 10:03:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 2,036 bytes |
コンパイル時間 | 1,604 ms |
コンパイル使用メモリ | 170,984 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 09:44:51 |
合計ジャッジ時間 | 2,342 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vll = vector<ll>; using vvi = vector<vi>; using vvll = vector<vll>; using vvvll = vector<vvll>; using vs = vector<string>; using vb = vector<bool>; const int IntINF = 1 << 30; const ll LLINF = 1LL << 60; #define REP(i, a, n) for (ll i = (a); i < (ll)(n); ++i) #define rep(i, n) REP(i, 0, n) #define r_REP(i, a, n) for (ll i = (n - 1); i >= (ll)(a); --i) #define r_rep(i, n) r_REP(i, 0, n) #define what_is(x) cerr << #x << " is " << x << endl; template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << p.first << " " << p.second; return os; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { os << v[i] << (i < (ll)v.size() - 1 ? " " : ""); } return os; } template <typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { rep(i, v.size()) { rep(j, v[i].size()) { os << v[i][j] << (j < (ll)v[i].size() - 1 ? " " : ""); } os << endl; } return os; } template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &v) { for (const auto &p : v) { os << p.first << ": " << p.second << endl; } return os; } inline void io_setup(int precision = 15) { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(precision); cerr << fixed << setprecision(precision); } template <typename T = long long> vector<pair<T, T>> prime_factor_pair(T n) { vector<pair<T, T>> res; for (T i = 2; i * i <= n; ++i) { if (n % i != 0) { continue; } T ex = 0; while (n % i == 0) { ++ex; n /= i; } res.emplace_back(i, ex); } if (n != 1) { res.emplace_back(n, 1); } return res; } int main() { io_setup(); int N; cin >> N; auto pfs = prime_factor_pair(N); ll xor_sum = 0; for (auto pf : pfs) { xor_sum ^= pf.second; } cout << (xor_sum == 0 ? "Bob" : "Alice") << endl; return 0; }