結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2014-10-29 22:09:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 609 bytes |
コンパイル時間 | 1,807 ms |
コンパイル使用メモリ | 164,840 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 10:43:46 |
合計ジャッジ時間 | 2,981 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long int64; #define ForEach(it,c) for(__typeof (c).begin() it = (c).begin(); it != (c).end(); it++) map< int , int > prime_factor(int n){ map< int , int > ret; for(int i = 2; i * i <= n; i++){ while(n % i == 0){ ret[i]++; n /= i; } } if(n != 1) ret[n] = 1; return ret; } int main(){ int N; cin >> N; map< int , int > primes = prime_factor(N); int nim = 0; ForEach( it, primes){ nim ^= it -> second; } if(nim == 0) cout << "Bob" << endl; else cout << "Alice" << endl; }