結果

問題 No.82 市松模様
ユーザー focus
提出日時 2018-01-24 00:21:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 670 bytes
コンパイル時間 632 ms
コンパイル使用メモリ 63,996 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 03:56:53
合計ジャッジ時間 1,085 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    int W,H;
    char C,table[60];
    cin >> W >> H >> C;
    for(int x=1;x<=W+6;x+=2){
        if(C=='B'){
            table[x]='W';
            table[x+1]='B';
        }
        else{
            table[x]='B';
            table[x+1]='W';
        }
    }
    for(int y=1;y<=H;y++){
        if(y%2){
            for(int x=2;x<=W+1;x++){
                cout << table[x];
            }
        }
        else{
            for(int x=1;x<=W;x++){
                cout << table[x];
            }
        }
        cout << endl;
    }
    return 0;
}

0