結果

問題 No.82 市松模様
ユーザー LV3zJigVW57oPGyLV3zJigVW57oPGy
提出日時 2022-11-15 23:29:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 712 bytes
コンパイル時間 1,837 ms
コンパイル使用メモリ 164,560 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-16 22:11:08
合計ジャッジ時間 2,662 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h> 
using namespace std;
#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string>
#include <algorithm>

int main(){
  int a, b;
  char design;
  cin >> a >> b >> design;
  vector<vector<char>> vec(b, vector<char>(a));
  for(int i=0;i<b;i++){
    for(int k=0;k<a;k++){
      	if(design=='W'){
        	if(((k%2==0)&&(i%2==0))||((k%2==1)&&(i%2==1))){
          	vec.at(i).at(k)='W';
        	}
        	else vec.at(i).at(k)='B';
      	}
      	else if(design=='B'){
        	if(((k%2==0)&&(i%2==0))||((k%2==1)&&(i%2==1))){
          	vec.at(i).at(k)='B';
        	}
        	else vec.at(i).at(k)='W';
      	}
       cout << vec.at(i).at(k);
    }
    cout << endl;
  }
}
0