백준_11048_이동하기 / DP**
허허허허허 이전꺼(목장 건설하기) 풀고 지금꺼(이동하기) 푸니까 쉽다면서 풀었는데 틀렸다 ㅎ허허허허허허 나 이런 문제 풀었엇는데 ㅠㅠㅠㅠ 뭐 배열 하나 더 만들어서,,, 그 저장하고,,어쩌구,,,허허,,, 풀기싫다,,, 메모리초과 -> 완전탐색으로 풀었기때문이지! #include #include #include using namespace std; int N, M; // 미로 크기 (N,M) int getMostCandies(vector _arr, int _x, int _y, // 현재위치 x,y int _sum) // 여기까지(현재위치빼고) 오는데 합한 사탕의 수 { int sum = _sum + _arr[_x][_y]; if (_x==(N-1) && _y==(M-1)) { // 탈출조건 return ..
2018. 9. 21.
백준_1012_유기농 배추
맞은 정답 // c++ 쓰기 #include #include using namespace std; int testcase; int m, n, k; // 가로길이, 세로길이, 배추 개수 int arr[51][51] = { 0, }; int cnt = 0; // 배추 갯수 int result; int x_offset[4] = { 0,0,-1,1 }; // 상 하 좌 우 int y_offset[4] = { 1,-1,0,0 }; void func(int x, int y); int main(void) { cin >> testcase; for (int i = 0; i > m >> n >> k; for (int j = 0; j < k; j++) { int x, y; cin ..
2018. 7. 19.