結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2017-06-27 20:06:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 355 bytes |
コンパイル時間 | 212 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-04 13:34:34 |
合計ジャッジ時間 | 684 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 2 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d %d %c",&W,&H,&c); | ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>main(){int W,H;char c;scanf("%d %d %c",&W,&H,&c);char color[] = "BW";int bw = c=='B'?0:1;//bならば0for(int i = 0;i < H;i++){for(int j = 0;j < W;j++){printf("%c",color[bw]);bw = !bw;}bw = W%2==0?!bw:bw;//偶数なら反転printf("\n");}}