結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-09 23:12:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 676 bytes |
| コンパイル時間 | 732 ms |
| コンパイル使用メモリ | 77,392 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 12:56:39 |
| 合計ジャッジ時間 | 1,725 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
ソースコード
#include <iostream>
#include <map>
using namespace std;
map<int,int> prime_factor(int n){
map<int,int> res;
for(int i = 2; i * i <= n; i++){
while(n % i == 0){
++res[i];
n /= i;
}
}
if(n != 1) res[n] = 1;
return res;
}
int main(){
int n;
cin >> n;
map<int,int> table;
table = prime_factor(n);
int ans = 0;
bool is_fisrt = false;
for(auto e : table){
if(is_fisrt){
ans = e.second;
is_fisrt = true;
}else{
ans = ans ^ e.second;
}
}
if(ans == 0) cout << "Bob" <<endl;
else cout << "Alice" << endl;
return 0;
}