結果

問題 No.1665 quotient replace
ユーザー pengin_2000
提出日時 2021-09-03 22:12:37
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 173 ms / 3,000 ms
コード長 533 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 30,080 KB
実行使用メモリ 9,564 KB
最終ジャッジ日時 2024-12-15 13:50:47
合計ジャッジ時間 5,270 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i, j;
	int a[1000006];
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	int div[1000006];
	for (i = 0; i < 1000006; i++)
		div[i] = i;
	for (i = 2; i < 1000006; i++)
	{
		if (div[i] != i)
			continue;
		for (j = 2; i * j < 1000006; j++)
			div[i * j] = i;
	}
	long long int x = 0, cnt;
	for (i = 0; i < n; i++)
	{
		cnt = 0;
		while (a[i] > 1)
		{
			cnt++;
			a[i] /= div[a[i]];
		}
		x ^= cnt;
	}
	if (x == 0)
		printf("black\n");
	else
		printf("white\n");
	return 0;
}
0