結果

問題 No.82 市松模様
ユーザー tottoripaper
提出日時 2015-01-13 22:55:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 318 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 05:20:12
合計ジャッジ時間 872 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 <cstdio>

int main(){
    int W, H;
    char C;
    scanf("%d %d %c", &W, &H, &C);

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if((i+j) % 2 == 0){
                putchar(C);
            }else{
                putchar('W' + 'B' - C);
            }
        }
        puts("");
    }
}
0