結果

問題 No.82 市松模様
ユーザー カルロス
提出日時 2015-08-27 14:27:44
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 652 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 14:59:33
合計ジャッジ時間 554 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d %d %c", &W, &H, &color);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){

    int i, j, W, H;
    char color;
    scanf("%d %d %c", &W, &H, &color);
    if(color=='B'){
        for(i=1;i<=H;i++){
            for(j=1;j<=W;j++){
                if((i+j)%2){
                    printf("W");
                }else{
                    printf("B");
                }
            }
            printf("\n");
        }
    }else{
        for(i=1;i<=H;i++){
            for(j=1;j<=W;j++){
                if((i+j)%2){
                    printf("B");
                }else{
                    printf("W");
                }
            }
            printf("\n");
        }
    }
    return 0;
}
0