結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
|
提出日時 | 2023-02-10 17:12:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 533 bytes |
コンパイル時間 | 524 ms |
コンパイル使用メモリ | 67,976 KB |
最終ジャッジ日時 | 2025-02-10 11:54:01 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <iostream> int isqrt(int n) { int x = n; int y = (x + 1) / 2; while (y < x) { x = y; y = (x + n / x) / 2; } return x; } int main() { int N; std::cin >> N; int _xor = 0; for (int x = 2; x <= isqrt(N); x++) { int tmp = 0; while (N % x == 0) { N /= x; tmp += 1; } _xor ^= tmp; } if (N != 1) { _xor ^= 1; } std::string ans = (_xor == 0) ? "Bob" : "Alice"; std::cout << ans << std::endl; }