結果
| 問題 |
No.82 市松模様
|
| コンテスト | |
| ユーザー |
Futa_Goza_Nico
|
| 提出日時 | 2014-12-02 23:51:50 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 403 bytes |
| コンパイル時間 | 140 ms |
| コンパイル使用メモリ | 22,784 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 07:49:35 |
| 合計ジャッジ時間 | 561 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 3 WA * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:17: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[50]’ [-Wformat=]
10 | scanf("%s", &c);
| ~^ ~~
| | |
| | char (*)[50]
| char*
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d", &w);
| ~~~~~^~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d", &h);
| ~~~~~^~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%s", &c);
| ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void) {
char c[50];
int w = 0;
int h = 0;
scanf("%d", &w);
scanf("%d", &h);
scanf("%s", &c);
int i = 3;
if (c == "B") {
i = 1;
} else {
i = 2;
}
for(int j = 0; j < h; j++) {
for(int n = 0; n < w; n++) {
i = 3 - i;
if (i == 1) {
printf("W");
} else {
printf("B");
}
}
printf("\n");
}
return 0;
}
Futa_Goza_Nico