結果

問題 No.2 素因数ゲーム
ユーザー tonyu0
提出日時 2019-10-14 11:55:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 591 ms
コンパイル使用メモリ 71,424 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 13:29:04
合計ジャッジ時間 1,520 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
	int N;
	vector<pair<int, int>> ps;
	cin >> N;

	for (int i = 2; i * i <= N; ++i) {
		if (N % i == 0) {
			int cnt = 0;
			while (N % i == 0) {
				++cnt;
				N /= i;
			}
			ps.emplace_back(i, cnt);
		}
	}
	if (N != 1) ps.emplace_back(N, 1);
	
	int res = 0;
	for (auto p : ps) res ^= p.second;
	if (res) cout << "Alice";
	else cout << "Bob";
	cout << endl;
}
0