結果

問題 No.103 素因数ゲーム リターンズ
ユーザー hotpepsi
提出日時 2014-12-16 00:50:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 62,876 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 21:26:54
合計ジャッジ時間 1,290 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
	string s;
	getline(cin, s);
	int N = atoi(s.c_str());
	getline(cin, s);
	stringstream ss(s);
	int g = 0;
	for (int i = 0; i < N; ++i) {
		int a;
		ss >> a;
		for (int b = 2; a >= b; ++b) {
			int c = 0;
			while ((a % b) == 0) {
				++c;
				a /= b;
			}
			g ^= (c % 3);
		}
	}
	cout << ((g != 0) ? "Alice" : "Bob") << endl;
	return 0;
}
0