結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
|
提出日時 | 2024-02-14 19:57:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 296 ms / 5,000 ms |
コード長 | 920 bytes |
コンパイル時間 | 953 ms |
コンパイル使用メモリ | 98,772 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 18:59:41 |
合計ジャッジ時間 | 2,554 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <numeric> #include <map> #include <algorithm> #include <set> #include <queue> #include <random> using namespace std; #define rep(i,m,n) for(int i=m; i<n; i++) #define INF (1 << 30) using ll = long long; using ull = unsigned long long; std::random_device rng; //test //erase leaves: std::iota, union_find //swapping puzzle: std::next_permutation //festival: lower_bound int main() { int n; cin >> n; int i = 1; vector<int> s; while (n!=1) { ++i; if (n % i != 0) continue; s.push_back(0); while (n % i == 0) { s.back()++; n /= i; } } int s_size = (int)s.size(); int ans = s[0]; rep(i, 1, s_size) { ans ^= s[i]; } if (0 < ans) { cout << "Alice" << endl; } else { cout << "Bob" << endl; } return 0; }