結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2016-09-13 21:22:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 302 ms / 5,000 ms |
コード長 | 583 bytes |
コンパイル時間 | 2,608 ms |
コンパイル使用メモリ | 157,176 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 12:44:57 |
合計ジャッジ時間 | 3,496 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, j) for(int i=0; i < (int)(j); i++) class Solver { public: bool solve() { int n; cin >> n; int grundy = 0; for(int i = 2; n > 1; i++) { int cnt = 0; while(n % i == 0) { n /= i; cnt++; } grundy ^= cnt; } cout << (grundy != 0 ? "Alice" : "Bob") << endl; return 0; } }; int main() { cin.tie(0); ios::sync_with_stdio(false); Solver s; s.solve(); return 0; }