結果

問題 No.82 市松模様
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-08-25 15:34:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 556 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 62,444 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 15:16:48
合計ジャッジ時間 942 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int main(void){
	int w, h; cin >> w >> h;
	string c; cin >> c;
	int cnt;
	if(c == "B") cnt = 0;
	else cnt = 1;
	rep(i, h){
		string tmp;
		if(cnt % 2 == 0){
			int f = 0;
			rep(j, w){
				if(f % 2 == 0) tmp += 'B';
				else tmp += 'W';
				f++;
			}
		}else{
			int f = 1;
			rep(j, w){
				if(f % 2 == 0) tmp += 'B';
				else tmp += 'W';
				f++;
			}
		}
		cout << tmp << endl;
		cnt++;
	}
}
0