結果

問題 No.103 素因数ゲーム リターンズ
コンテスト
ユーザー bal4u
提出日時 2019-07-22 10:27:50
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 0 ms / 5,000 ms
+ 890µs
コード長 628 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 72 ms
コンパイル使用メモリ 40,832 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-22 10:36:56
合計ジャッジ時間 1,519 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// yukicoder: No.103 素因数ゲーム リターンズ
// 2019.7.22 bal4u

#include <stdio.h>
#include <math.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

int main()
{
	int i, N, m, b, p, ans;

	ans = 0;
	N = in(); while (N--) {
		m = in(), b = (int)sqrt((double)m);
		for (i = 2; m >= i && i <= b; i++) {
			if (m % i == 0) {
				p = 0; while (m % i == 0) m /= i, p++;
				ans ^= p % 3;
			}
		}
		if (m > 1) ans ^= 1;
	}
	puts(ans ? "Alice" : "Bob");
	return 0;
}
0