結果

問題 No.82 市松模様
ユーザー cielciel
提出日時 2014-12-02 23:28:47
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 221 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 23,040 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 07:42:57
合計ジャッジ時間 656 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 4 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:23: warning: format ‘%c’ expects argument of type ‘char*’, but argument 4 has type ‘int*’ [-Wformat=]
    5 |         scanf("%d %d %c",&W,&H,&C);
      |                      ~^        ~~
      |                       |        |
      |                       char*    int*
      |                      %d
main.cpp:5:14: 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);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
const char *s="BW";
int main(){
	int W,H,C;
	scanf("%d %d %c",&W,&H,&C);
	C=C==W;
	int y,x;
	for(y=0;y<H;y++){
		for(x=0;x<W;x++){
			putchar(s[(y+x+C)%2]);
		}
		puts("");
	}
	return 0;
}
0