結果

問題 No.82 市松模様
ユーザー a_tena_ten
提出日時 2016-03-23 14:52:09
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 563 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-09 21:01:14
合計ジャッジ時間 1,085 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,812 KB
testcase_01 AC 11 ms
6,944 KB
testcase_02 AC 11 ms
6,940 KB
testcase_03 AC 11 ms
6,944 KB
testcase_04 AC 10 ms
6,944 KB
testcase_05 AC 11 ms
6,940 KB
testcase_06 AC 10 ms
6,940 KB
testcase_07 AC 11 ms
6,940 KB
testcase_08 AC 11 ms
6,940 KB
testcase_09 AC 11 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

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