제출 #1224217

#제출 시각아이디문제언어결과실행 시간메모리
1224217sleepntsheepNautilus (BOI19_nautilus)C11
29 / 100
4 ms328 KiB
#include <stdio.h> #include <string.h> int r, c, m, dx[] = { -1, 1, 0, 0 }, dy[] = { 0, 0, 1, -1 }, z; char d[333], s[333][333]; int main() { scanf("%d%d%d", &r, &c, &m); for (int i = 0; i < r; ++i) scanf("%s", s[i]); scanf("%s", d); for (int i = 0; i < r; ++i) { for (int j = 0; j < c; ++j) { int i_, j_, ok; i_ = i, j_ = j, ok = 1; if (s[i][j] == '#') continue; for (int k = m - 1; k >= 0; --k) { const char *ss = "EWNS"; int k_ = strchr(ss, d[k]) - ss; i_ += dy[k_], j_ += dx[k_]; if (i_ < 0 || j_ < 0 || i_ >= r || j_ >= c || s[i_][j_] == '#') { ok = 0; break; } } if (ok) ++z; } } printf("%d\n", z); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

nautilus.c: In function 'main':
nautilus.c:8:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d%d%d", &r, &c, &m);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
nautilus.c:10:17: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |                 scanf("%s", s[i]);
      |                 ^~~~~~~~~~~~~~~~~
nautilus.c:11:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%s", d);
      |         ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...