結果

問題 No.82 市松模様
ユーザー SyuutaroSyuutaro
提出日時 2018-03-14 23:57:06
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 574 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 22,656 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 02:30:06
合計ジャッジ時間 733 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d %d %c",&W,&H,&C);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
    //iuput
    int W,H;
    char C;
    scanf("%d %d %c",&W,&H,&C);

    //output
    for (int y = 0;y < H;y++){
        for (int x = 0;x < W;x++){
            if ((x+y)%2 == 0){
                if (C == 'B'){
                    printf("B");
                }else{
                    printf("W");
                }
            }else{
                if (C == 'B'){
                    printf("W");
                }else{
                    printf("B");
                }
            }
        }
        printf("\n");
    }
    return 0;
}
0