-
[프로그래머스] 주사위 게임 3알고리즘 노트 2023. 10. 17. 10:29
역대급으로 복잡한 지문에 당황하며 풀었다..
위의 다섯 가지 조건식 중 맨 마지막의 조건에서 정렬을 해야한다는 힌트를 얻는게 중요한 것 같다.
어쨋든 4개의 정수가 주어지면 정렬을 해놓고 작업하는게 편하다.
[문제풀이]
1. 가장 먼저 List.of를 활용하여 a, b, c, d를 정렬한 뒤 꺼내쓰기 편하게 Array로 만들어준다.
2. 이후 조건을 하나씩 대입하며 문항을 풀어낸다.
'알고리즘 노트' 카테고리의 다른 글
[프로그래머스] 9로 나눈 나머지 (0) 2023.10.17 [프로그래머스] 글자 이어 붙여 문자열 만들기 (0) 2023.10.17 [프로그래머스] 간단한 논리 연산 (0) 2023.10.17 [프로그래머스] 배열 만들기 4 (0) 2023.10.16 [프로그래머스] 콜라츠 수열 만들기 (0) 2023.10.16