結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2017-02-03 10:06:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 1,425 ms |
コンパイル使用メモリ | 157,968 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-24 04:06:33 |
合計ジャッジ時間 | 1,984 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int w, h; char c, n, m; bool flg = 1; cin >> w >> h >> c; if (c == 'B') { n = 'B'; m = 'W'; } else { n = 'W'; m = 'B'; } for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (flg == 1) { cout << n; flg = 0; } else { cout << m; flg = 1; } } if (w % 2 == 0) { if (flg == 1) { flg = 0; } else { flg = 1; } } cout << endl; } } #950832