답안 #321078

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
321078 2020-11-10T21:44:35 Z monus1042 보물 찾기 (CEOI13_treasure2) C++17
컴파일 오류
0 ms 0 KB
#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;

int ans[105][105];

void findTreasure (int N) {
    //int cnt = countTreasure(1, 1, N, N);
    //if(cnt > 0) Report (1, 1);
	ans[1][1] = countTreasure(1,1, 1,1);
	for (int i=1; i<=N; i++){
		for (int j=1; j<=N; j++){
			if (j==i && j == 1) continue;
			int acc = 0;
			for (int k=1; k<=i; k++){
				for (int l=1; l<=j; l++){
					acc += acc[k][l];
				}
			}
			/*for (int k=1; k<=i; k++){
				for (int l=1; l<=j - 1; l++){
					acc -= acc[k][l];
				}
			}
			for (int k=1; k<=i - 1; k++){
				for (int l=1; l<=j; l++){
					acc -= acc[k][l];
				}
			}
			for (int k=1; k<=i - 1; k++){
				for (int l=1; l<=j - 1; l++){
					acc += acc[k][l];
				}
				}*/
			ans[i][j] = countTreasue(1,1, i,j) - acc;
		}
	}

	for (int i=1; i<=N; i++){
		for (int j=1; j<=N; j++){
			if (ans[i][j]) Report(i,j);
		}
	}
}

Compilation message

treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:17:18: error: invalid types 'int[int]' for array subscript
   17 |      acc += acc[k][l];
      |                  ^
treasure.cpp:35:16: error: 'countTreasue' was not declared in this scope; did you mean 'countTreasure'?
   35 |    ans[i][j] = countTreasue(1,1, i,j) - acc;
      |                ^~~~~~~~~~~~
      |                countTreasure