結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2016-07-16 20:34:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 301 ms / 5,000 ms |
コード長 | 614 bytes |
コンパイル時間 | 1,191 ms |
コンパイル使用メモリ | 85,484 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 12:36:39 |
合計ジャッジ時間 | 3,265 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <iostream> #include <sstream> #include <string> #include <vector> #include <functional> #include <tuple> #include <climits> #include <algorithm> #include <unordered_map> using namespace std; int pf(int n) { unordered_map<int, int> factor; for(int i=2;;i++) { if(n % i == 0) { factor[i]++; n = n / i; i = 1; if(n == 1) break; continue; } } int w = 0; for(auto &p : factor) { w ^= p.second; } return w; } int main() { int N; cin >> N; cout << (pf(N)!=0?"Alice":"Bob") << endl; }