結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2017-11-22 04:24:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 767 bytes |
コンパイル時間 | 729 ms |
コンパイル使用メモリ | 84,252 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-26 08:43:31 |
合計ジャッジ時間 | 1,298 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<cmath> #include<math.h> #include<iomanip> #include<stdio.h> #include<random> #include<ctime> #include<cstdlib> using namespace std; int main(){ int w, h; char c, c_other, ans[50][50]; cin >> w >> h >> c; if(c=='W'){ c_other='B'; } else { c_other='W'; } for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ if(i%2!=0){ if(j%2!=0){ ans[i][j]=c; } else { ans[i][j]=c_other; } } else { if(j%2!=0){ ans[i][j]=c_other; } else { ans[i][j]=c; } } } } for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ cout << ans[i][j]; } cout << endl; } return 0; }