結果
| 問題 | No.103 素因数ゲーム リターンズ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-10-10 01:13:40 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 486 bytes | 
| コンパイル時間 | 2,268 ms | 
| コンパイル使用メモリ | 196,432 KB | 
| 最終ジャッジ日時 | 2025-02-17 06:34:07 | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 20 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N; cin >> N;
	
	vector<int> cnts;
	for (int i = 0; i < N; i++) {
		int M; cin >> M;
		for (int j = 2; j*j <= M; j++) {
			int cnt = 0;
			while (M%j == 0) {
				cnt++;
				M /= j;
			}
			cnts.push_back(cnt);
		}
		if (M > 1) cnts.push_back(1);
	}
	
	int val = 0;
	for (int i = 0; i < cnts.size(); i++) {
		val ^= cnts[i]%3;
	}
	if (val) {
		cout << "Alice" << endl;
	} else {
		cout << "Bob" << endl;
	}
	return (0);
}
            
            
            
        