제출 #916530

#제출 시각아이디문제언어결과실행 시간메모리
916530vjudge1Dango Maker (JOI18_dango_maker)C++11
컴파일 에러
0 ms0 KiB
#include <iostream> using namespace std; int N, M, ans; char a[3010][3010]; int validG(int x, int y) { if (a[x-1][y] == 'R' && a[x][y] == 'G' && a[x+1][y] == 'W') return 1; if (a[x][y-1] == 'R' && a[x][y] == 'G' && a[x][y+1] == 'W') return 2; return false; } bool overlap(int x, int y) { return (validG(x,y) + validG(x-1,y+1) == 3)) } int main() { cin >> N >> M; for(int i=1; i<=N; i++) { for(int j=1; j<=M; j++) { cin >> a[i][j]; } } for(int i=1; i<=N; i++) { int x = i; int y = 1; while(x>=1 && y<=M) { if (validG(x,y)) { ans++; if(overlap(x,y)) { x--; y++; } } x--; y++; } } for(int j=2; j<=M; j++) { int x = N; int y = j; while(x>=1 && y<=M) { if (validG(x,y)) { ans++; if(overlap(x,y)) { x--; y++; } } x--; y++; } } cout << ans << endl; }

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

dango_maker.cpp: In function 'bool overlap(int, int)':
dango_maker.cpp:14:46: error: expected ';' before ')' token
   14 |   return (validG(x,y) + validG(x-1,y+1) == 3))
      |                                              ^
      |                                              ;
dango_maker.cpp:14:46: error: expected primary-expression before ')' token