結果

問題 No.82 市松模様
ユーザー Pictogram1010
提出日時 2016-07-14 17:37:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 477 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 55,388 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 17:13:14
合計ジャッジ時間 970 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main()
{
	int W, H;
	string C;

	cin >> W >> H >> C;

	if (C == "B"){
		for (int j = 0; j < H; j++){
			for (int i = 0; i < W; i++)
			{
				if ((i + j) % 2 == 0)
					cout << 'B';
				else
					cout << 'W';
			}
			cout << endl;
		}
	}
	else
	{
		for (int j = 0; j < H; j++){
			for (int i = 0; i < W; i++)
			{
				if ((i + j) % 2 == 0)
					cout << 'W';
				else
					cout << 'B';
			}
			cout << endl;
		}
	}
}
0