https://school.programmers.co.kr/learn/courses/30/lessons/12913
int solution(vector<vector<int> > land)
{
int answer = 0;
for(int i = 0; i < land.size()-1 ; i++){
land[i+1][0] += max(land[i][1],max(land[i][2],land[i][3]));
land[i+1][1] += max(land[i][0],max(land[i][2],land[i][3]));
land[i+1][2] += max(land[i][0],max(land[i][1],land[i][3]));
land[i+1][3] += max(land[i][0],max(land[i][1],land[i][2]));
}
answer = max(land[land.size()-1][0], max(land[land.size()-1][1], max( land[land.size()-1][2], land[land.size()-1][3] )));
return answer;
}
'Coding Test > Programmers' 카테고리의 다른 글
[Programmers] (Summer/Winter Coding(~2018)) Lv 2. 방문 길이 (0) | 2023.07.10 |
---|---|
[Programmers] (스택/큐) Lv 2. 주식가격 (0) | 2023.07.09 |
[Programmers] (2019 KAKAO BLIND RECRUITMENT) Lv 2. 오픈채팅방 (0) | 2023.07.09 |
[Programmers] (2022 KAKAO BLIND RECRUITMENT) Lv 2. 주차 요금 계산 (0) | 2023.07.07 |
[Programmers] (힙(Heap)) Lv 2. 더 맵게 (0) | 2023.07.04 |
댓글