結果
| 問題 |
No.82 市松模様
|
| コンテスト | |
| ユーザー |
Elk
|
| 提出日時 | 2018-05-27 01:18:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 455 bytes |
| コンパイル時間 | 111 ms |
| コンパイル使用メモリ | 22,784 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 18:19:06 |
| 合計ジャッジ時間 | 604 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d %d %c", &width, &height, &color);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
int width, height;
int i, j;
char color;
char BW[3] = "BW";
scanf("%d %d %c", &width, &height, &color);
for(i = 0; i < height; i++){
for(j = 0; j < width; j++){
if(color == 'B'){
printf("%c", BW[(j + i)%2]);
}else if(color == 'W'){
printf("%c", BW[(j + i + 1)%2]);
}
}
printf("\n");
}
return 0;
}
Elk