結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
![]() |
提出日時 | 2023-07-01 00:09:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 5,000 ms |
コード長 | 666 bytes |
コンパイル時間 | 1,891 ms |
コンパイル使用メモリ | 195,340 KB |
最終ジャッジ日時 | 2025-02-15 04:49:36 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n; cin >> n; vector<pair<int, int>> pf(0); for (int i = 2; i * i <= n; i++) { if (n % i == 0) { pf.push_back({ i, 0 }); while (n % i == 0) { pf.back().second++; n /= i; } } } if (n != 1) pf.push_back({ n, 1 }); Debug(pf); int cnt = 0; for (auto [p, e] : pf) cnt ^= e; if (cnt == 0) cout << "Bob" << endl; else cout << "Alice" << endl; return 0; }