結果

問題 No.82 市松模様
ユーザー neeetneeet
提出日時 2017-06-17 17:08:01
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 404 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 20:29:23
合計ジャッジ時間 799 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,676 KB
testcase_01 AC 0 ms
6,676 KB
testcase_02 AC 0 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 0 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 0 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   scanf("%hd%hd %c", &w, &h, &c);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
  short w, h;
  char c, i, j;

  scanf("%hd%hd %c", &w, &h, &c);
  for(i = 0; i < h; i++){
    if((c & 0x7F) == 'B'){
      c = (c & 0x7F) | (i << 7);
    }
    else
      c = (c & 0x7F) | ((i ^ 0x01) << 7);
    for(j = 0; j < w; j++){
      if(c & 0x80)
        printf("W");
      else
        printf("B");
      c ^= 0x80;
    }
    printf("\n");
  }
    return 0;
}
0