結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2016-07-26 16:43:19 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 150 ms |
コンパイル使用メモリ | 21,120 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-03 03:26:26 |
合計ジャッジ時間 | 1,196 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 6 |
other | WA * 40 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:12:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d %d", &h, &w); | ^~~~~~~~~~~~~~~~~~~~~~ main.c:14:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%s", s+i*w); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> #define N 50 char s[N*N+1], ss[N*N+1]; int main() { int h, w, i, j; char *p; scanf("%d %d", &h, &w); for (i = 0; i < h; i++) { scanf("%s", s+i*w); } strcpy(ss, s); p = strchr(ss, '#'); if (p == NULL) { puts("YES\n"); return 0; } for (i = 1; p[i] != '\0'; i++) { for (j = 0; p[i+j] != '\0'; j++) { if (p[j] == '#') { p[j] = 'R'; if (p[i+j] != '#') break; p[i+j] = 'B'; } } if (strchr(p, '#') == NULL) { puts("YES\n"); return 0; } strcpy(ss, s); } puts("NO\n"); return 0; }