結果

問題 No.82 市松模様
ユーザー a_ten
提出日時 2016-03-23 14:52:09
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 563 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-10-01 21:26:35
合計ジャッジ時間 1,020 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding:utf-8

s=raw_input().split()
w=int(s[0])
h=int(s[1])
h1=h
n=s[2]
	
h_even=''
h_odd=''
while h:
	if h%2==1:
		for i in range(w):
			if i%2==0:
				h_even+=n
			else:
				if n=='B':
					h_even+='W'
				else:
					h_even+='B'

	else:
		for i in range(w):
			if i%2==1:
				h_odd+=n
			else:
				if n=='B':
					h_odd+='W'
				else:
					h_odd+='B'
	
	h-=1

h_even=list(h_even)	
h_odd=list(h_odd)

res=[]
for i in range(h1):
	if i%2==0:
		res.append(h_even[:w])
		del h_even[:w]
	else:
		res.append(h_odd[:w])
		del h_odd[:w]

for i in res:
	print ''.join(i)
0