結果

問題 No.82 市松模様
ユーザー Kura
提出日時 2019-02-21 22:56:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 529 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 55,864 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-21 11:08:02
合計ジャッジ時間 1,164 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int main() {
	int a, b;
	char c;
	cin >> a >> b >> c;
	char d = c;
	for (int i = 1; i <= a * b; i++) {
		if (i%a == 1) {
			cout << d;
			c = d;
			if (d == 'B') {
				d = 'W';
			}
			else {
				d = 'B';
			}
			if (c == 'B') {
				c = 'W';
			}
			else {
				c = 'B';
			}
		}
		else if (i%a == 0) {
			cout << c << endl;
			if (c == 'B') {
				c = 'W';
			}
			else {
				c = 'B';
			}
		}
		else {
			cout << c;
			if (c == 'B') {
				c = 'W';
			}
			else {
				c = 'B';
			}
		}
	}
}
0