結果

問題 No.1665 quotient replace
ユーザー atjh16atjh16
提出日時 2021-11-05 17:20:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 936 ms / 3,000 ms
コード長 602 bytes
コンパイル時間 2,187 ms
コンパイル使用メモリ 201,788 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-04-24 01:29:17
合計ジャッジ時間 15,881 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
8,064 KB
testcase_01 AC 24 ms
8,192 KB
testcase_02 AC 23 ms
8,192 KB
testcase_03 AC 24 ms
8,192 KB
testcase_04 AC 24 ms
8,192 KB
testcase_05 AC 24 ms
8,064 KB
testcase_06 AC 29 ms
8,192 KB
testcase_07 AC 25 ms
8,192 KB
testcase_08 AC 27 ms
8,192 KB
testcase_09 AC 45 ms
8,192 KB
testcase_10 AC 249 ms
8,192 KB
testcase_11 AC 529 ms
8,192 KB
testcase_12 AC 80 ms
8,192 KB
testcase_13 AC 693 ms
8,192 KB
testcase_14 AC 700 ms
8,064 KB
testcase_15 AC 691 ms
8,192 KB
testcase_16 AC 705 ms
8,320 KB
testcase_17 AC 704 ms
8,192 KB
testcase_18 AC 23 ms
8,064 KB
testcase_19 AC 24 ms
8,064 KB
testcase_20 AC 23 ms
8,192 KB
testcase_21 AC 23 ms
8,192 KB
testcase_22 AC 23 ms
8,320 KB
testcase_23 AC 24 ms
8,064 KB
testcase_24 AC 23 ms
8,192 KB
testcase_25 AC 23 ms
8,192 KB
testcase_26 AC 26 ms
8,064 KB
testcase_27 AC 32 ms
8,192 KB
testcase_28 AC 63 ms
8,064 KB
testcase_29 AC 105 ms
8,192 KB
testcase_30 AC 615 ms
8,192 KB
testcase_31 AC 936 ms
8,192 KB
testcase_32 AC 491 ms
8,192 KB
testcase_33 AC 191 ms
8,064 KB
testcase_34 AC 402 ms
8,320 KB
testcase_35 AC 360 ms
8,192 KB
testcase_36 AC 382 ms
8,064 KB
testcase_37 AC 360 ms
8,064 KB
testcase_38 AC 418 ms
8,064 KB
testcase_39 AC 307 ms
8,192 KB
testcase_40 AC 303 ms
8,064 KB
testcase_41 AC 300 ms
8,064 KB
testcase_42 AC 21 ms
8,192 KB
testcase_43 AC 22 ms
8,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int n, a, b, x = 0;
bool f[1000001];
set<int> p = { 2 };

int main()
{
	for (int i = 3; i < 1000000; i += 2) {
		if (!f[i]) {
			p.insert(i);

			if (i < 1000) {
				for (int j = i * i; j < 1000000; j += i * 2) {
					f[j] = 1;
				}
			}
		}
	}

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a;
		b = 0;

		for (int j : p) {
			while (a % j == 0) {
				a /= j;
				b++;
			}

			if (a == 1)
				break;
			else if (j > sqrt(a)) {
				b++;
				break;
			}
		}

		x ^= b;
	}
	
	if (x != 0)
		cout << "white" << endl;
	else
		cout << "black" << endl;
}
0