結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
|
提出日時 | 2022-09-27 21:30:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 692 bytes |
コンパイル時間 | 1,663 ms |
コンパイル使用メモリ | 168,924 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-22 17:11:15 |
合計ジャッジ時間 | 2,848 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(a) begin(a), end(a) #define sz(x) (int)((x).size()) #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 42 #endif void solve() { vector<int> stones; int n; cin >> n; for (int i = 2; (ll) i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) n /= i, cnt += 1; stones.emplace_back(cnt); } } if (n != 1) stones.emplace_back(1); int ans = accumulate(all(stones), 0, bit_xor<int>()); cout << (ans ? "Alice" : "Bob") << '\n'; } int main() { cin.tie(nullptr)->sync_with_stdio(false); int T = 1; // cin >> T; while (T--) solve(); return 0; }