結果

問題 No.82 市松模様
ユーザー chacoder1
提出日時 2020-11-23 18:26:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 352 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 192,812 KB
最終ジャッジ日時 2025-01-16 05:07:08
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
  int w,h;
  char c;
  cin>>w>>h>>c;
  int flag=1;
  if(c=='W') flag*=-1;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(flag==1){
        cout<<"B";
      }
      else{
        cout<<"W";
      }
      flag*=-1;
    }
    cout<<endl;
    if(w%2==0) flag*=-1;
  } 
  return 0;
}
  
0