結果
問題 | No.82 市松模様 |
ユーザー |
|
提出日時 | 2016-08-14 08:45:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 561 ms |
コンパイル使用メモリ | 55,168 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 16:40:26 |
合計ジャッジ時間 | 981 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:13: warning: ‘first_i’ may be used uninitialized in this function [-Wmaybe-uninitialized] 9 | int first_i; | ^~~~~~~
ソースコード
#include <iostream>auto main() -> int {int W, H;char C;std::cin >> W >> H >> C;char patterns[2] = {'W', 'B'};int first_i;switch (C) {case 'W': first_i = 0; break;case 'B': first_i = 1; break;}for (int y = 0; y < H; ++y) {for (int x = 0; x < W; ++x) {std::cout << patterns[(x+y+first_i)%2];}std::cout << std::endl;}}