結果

問題 No.82 市松模様
ユーザー ayaaya
提出日時 2019-07-30 12:39:18
言語 PHP
(8.3.4)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 18,476 KB
実行使用メモリ 18,912 KB
最終ジャッジ日時 2023-09-17 06:10:14
合計ジャッジ時間 905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,776 KB
testcase_01 AC 16 ms
18,892 KB
testcase_02 AC 16 ms
18,704 KB
testcase_03 AC 15 ms
18,912 KB
testcase_04 AC 16 ms
18,840 KB
testcase_05 AC 15 ms
18,788 KB
testcase_06 AC 16 ms
18,860 KB
testcase_07 AC 17 ms
18,904 KB
testcase_08 AC 19 ms
18,752 KB
testcase_09 AC 19 ms
18,904 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$input=explode(" ",trim(fgets(STDIN)));
$width=$input[0];
$height=$input[1];
$color=$input[2];
$uncoler;
if($color[0]=="B"){
  $uncolor="W";
}else{
  $uncolor="B";
}
$pattern=array(array());
for($y=0;$y<$height;$y++){
  for($x=0;$x<$width;$x++){
    if(($x+$y)%2!=0){
    $pattern[$y][$x]=$uncolor;
    echo $pattern[$y][$x];
    }else{
      $pattern[$y][$x]=$color;
      echo $pattern[$y][$x];
    }
    if ($x==$width-1){
    echo "\n";
    }
  }

}
0