結果

問題 No.82 市松模様
ユーザー tonyu0
提出日時 2020-03-29 15:20:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 437 bytes
コンパイル時間 890 ms
コンパイル使用メモリ 74,892 KB
最終ジャッジ日時 2025-01-09 10:46:24
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using ll = long long;
using namespace std;
constexpr ll INF = 1LL << 60;

int w, h, a;
char c;

int main() {
	cin >> w >> h >> c;
	a = c == 'B';
		for (int i = 0; i < h; ++i) {
			string p;
			for (int j = 0; j < w; ++j) {
				if (a) p.push_back('B');
				else p.push_back('W');
				a ^= 1;
			}
			if (i & 1) reverse(p.begin(), p.end());
			cout << p << endl;
		}

	return 0;
}
0