結果

問題 No.82 市松模様
ユーザー hiyorihiyori
提出日時 2017-06-08 17:19:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 63,196 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-23 19:49:22
合計ジャッジ時間 1,291 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

int main()
{
    using std::cin;
    using std::cout;
    
    int W,H;
    char C;
    std::cin >> W >> H >> C;
    
    int flag;  //1:B, -1:W
    if(C=='B') { flag = 1; }
    else { flag = -1; }
    
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            if(flag>0) {
                cout << 'B';
                flag*=(-1);
            }
            else {
                cout << 'W';
                flag*=(-1);
            }
        }
        flag*=(-1);
        cout << '\n';
    }

    return 0;
}
0