結果

問題 No.82 市松模様
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-14 11:21:19
言語 PHP
(8.3.4)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 398 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 32,148 KB
実行使用メモリ 31,500 KB
最終ジャッジ日時 2024-04-16 19:25:14
合計ジャッジ時間 1,063 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
31,152 KB
testcase_01 AC 40 ms
31,192 KB
testcase_02 AC 41 ms
31,488 KB
testcase_03 AC 41 ms
31,132 KB
testcase_04 AC 41 ms
31,408 KB
testcase_05 AC 42 ms
31,056 KB
testcase_06 AC 41 ms
31,460 KB
testcase_07 AC 41 ms
31,496 KB
testcase_08 AC 41 ms
31,288 KB
testcase_09 AC 42 ms
31,500 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$array = explode(" ", trim(fgets(STDIN)));
$W = $array[0];
$H = $array[1];
$C = $array[2];
$color = array('B', 'W');
$index = 1;
if($C == 'W') $index = 0;
for($i = 0; $i < $H; $i++) {
  $str = "";
  $index = 1 - $index;
  for($j = 0; $j < $W; $j++) {
    if($j % 2 == 0) {
      $str .= $color[$index];
    } else {
      $str .= $color[1 - $index];
    }
  }
  echo($str);
  echo("\n");
}
?>
0