結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2020-04-24 05:51:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 506 bytes |
コンパイル時間 | 674 ms |
コンパイル使用メモリ | 81,232 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-15 01:12:27 |
合計ジャッジ時間 | 1,668 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <algorithm> #include <iostream> #include <vector> using namespace std; #include <map> map<long long, int> prime_factorize(long long n) { map<long long, int> res; for (long long p = 2; p * p <= n; ++p) { while (n % p == 0) { ++res[p]; n /= p; } } if (n != 1) res[n] = 1; return res; } int main() { int n; cin >> n; int nim = 0; for (auto &p: prime_factorize(n)) { nim ^= p.second; } cout << (nim ? "Alice" : "Bob") << endl; return 0; }