結果

問題 No.82 市松模様
ユーザー maimai
提出日時 2016-02-04 14:34:03
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 268 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 19,904 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 19:11:23
合計ジャッジ時間 911 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 0 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:5: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    4 |     scanf("%d%d%c%c",&w,&h,&c,&c);
      |     ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:4:5: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    4 |     scanf("%d%d%c%c",&w,&h,&c,&c);
      |     ^~~~~
main.c:4:5: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:8:13: warning: implicit declaration of function ‘putchar’ [-Wimplicit-function-declaration]
    8 |             putchar(str[f=!f]);
      |             ^~~~~~~
main.c:8:13: note: include ‘<stdio.h>’ or provide a declaration of ‘putchar’

ソースコード

diff #

int main(){
    char str[]={'B','W'};
    int w,h,x,y;int f;char c;
    scanf("%d%d%c%c",&w,&h,&c,&c);
    f=c=='B';
    for (y=0;y<h;y++){
        for (x=0;x<w;x++)
            putchar(str[f=!f]);
        if (!(w%2)) f=!f;
        putchar('\n');
    }
    return 0;
}
0