結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2017-08-09 14:01:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 659 ms |
コンパイル使用メモリ | 65,712 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 03:53:58 |
合計ジャッジ時間 | 1,129 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int w,h; string c; cin >> w >> h >> c; //w,h vector生成 vector< vector<string> > arr; arr.resize(h); for (int i = 0; i < h; i++) { arr[i].resize(w); } //arrにBW入力、出力 string s; if (c == "B") { s = "W" ;} if (c == "W") { s = "B" ;} for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if ((i + j) % 2 == 0) { arr[i][j] = c; }else { arr[i][j] = s; } if (j == w - 1) { cout << arr[i][j] << "\n"; }else{ cout << arr[i][j]; } } } return 0; }