結果

問題 No.2 素因数ゲーム
ユーザー tsukio
提出日時 2016-03-24 17:06:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 293 ms / 5,000 ms
コード長 462 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 68,980 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 12:25:28
合計ジャッジ時間 2,400 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <unordered_map>
using namespace std;

int main() {
	int n;
	cin >> n;

	unordered_map<int, int> count_prime_factors;
	while (n != 1) {
		for (int i = 2; i <= n; i++) {
			if (n % i == 0) {
				n /= i;
				count_prime_factors[i]++;
				break;
			}
		}
	}

	int bit = 0;
	for (auto pair : count_prime_factors) {
		bit ^= pair.second;
	}

	if (bit == 0) {
		cout << "Bob" << endl;
	}
	else {
		cout << "Alice" << endl;
	}

	return 0;
}
0