結果

問題 No.1665 quotient replace
ユーザー lanegue
提出日時 2021-09-05 01:21:24
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 2,043 ms
コンパイル使用メモリ 232,944 KB
実行使用メモリ 37,648 KB
最終ジャッジ日時 2024-06-22 12:20:00
合計ジャッジ時間 11,145 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;
void main(){
	auto n=readln.chomp.to!int;
	auto a=readln.chomp.split(" ").to!(int[]);
	auto p=[2];
	for(auto i=3; i<10^^3; i+=2){
		auto f=true;
		for(auto j=0; p[j]^^2<=i; j++){
			if(i%p[j]==0){
				f=false;
				break;
			}
		}
		if(f){
			p~=i;
		}
	}
	auto c=new int[n];
	for(auto i=0; i<n; i++){
		auto x=a[i];
		for(auto j=0; j<p.length;){
			if(x%p[j]==0){
				c[i]++;
				x/=p[j];
			}else if(x<p[j]^^2){
				if(x>1) c[i]++;
				break;
			}else{
				j++;
			}
		}
	}
	//stderr.writeln(c);
	auto r=c.reduce!((a,b) => a^b);
	stderr.writeln(r);
	if(r!=0){
		writeln("white");
	}else{
		writeln("black");
	}
}
0