문제 풀러가기✍🏻 시행착오(Trial&Error) 분기를 수정하는 과정을 거쳤다. 풀이(Solution) 조건문 문제 답게 분기를 어떻게 할 것인가를 파악하는 것이 핵심이다. 즉, '분류'를 잘 해야 한다. 같은 눈이 3개인 경우, 2개인 경우, 모두 다를 경우를 어떻게 분기할지 잘 생각해야 한다. 코드(Code) import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] dice = new int[3]; for(int i = 0 ; i < dice.length; i++) { dice[i] = sc.nextInt(); } // 1. 같은 눈이 3..
알고리즘/문제풀이 - 백준
2022. 10. 25. 00:31
공지사항
