結果

問題 No.82 市松模様
ユーザー 綾地寧々綾地寧々
提出日時 2015-05-28 19:13:27
言語 PHP
(8.3.4)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 416 bytes
コンパイル時間 1,302 ms
コンパイル使用メモリ 18,608 KB
実行使用メモリ 18,868 KB
最終ジャッジ日時 2023-09-20 17:10:31
合計ジャッジ時間 2,078 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,764 KB
testcase_01 AC 15 ms
18,656 KB
testcase_02 AC 15 ms
18,832 KB
testcase_03 AC 15 ms
18,812 KB
testcase_04 AC 16 ms
18,768 KB
testcase_05 AC 15 ms
18,688 KB
testcase_06 AC 15 ms
18,868 KB
testcase_07 AC 15 ms
18,840 KB
testcase_08 AC 15 ms
18,824 KB
testcase_09 AC 15 ms
18,828 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
list($width,$height,$init) = explode(" ",trim(fgets(STDIN)));
$pattern = array('W','B');
$line = array(array());
$init_change = array_search($init, $pattern);
for ( $i=0; $i<$width; $i++ ) {
	$line[0][] = $pattern[($i+$init_change) % 2];
}
$line[1] = array_slice($line[0],1);
$line[1][] = $pattern[(count($line[0])+$init_change) % 2];
for ( $i=0; $i<$height; $i++ ) {
	echo implode("", $line[$i%2]).PHP_EOL;
}
0