結果

問題 No.82 市松模様
ユーザー TLwiegehtt
提出日時 2015-07-07 05:50:05
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 267 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 01:27:58
合計ジャッジ時間 643 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d %d %s", &w, &h, s);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	int i,j;
	int w,h;
	char s[5];
	scanf("%d %d %s", &w, &h, s);
	if(s[0] == 'W'){
		s[1] = 'B';
	}else{
		s[1] = 'W';
	}
	
	
	for(j=1;j<=h;j++){
		for(i=1;i<=w;i++){
			printf("%c", s[(i+j)%2]);
		}
		printf("\n");
	}
	
	return 0;
}
0