본문 바로가기
Project/Algorithm

[백준 알고리즘] 2490번(윷놀이)

by 도낙원 2017. 8. 2.
반응형

[백준 알고리즘]







오늘 풀어본 문제는 백준 알고리즘에 2490번 윷놀이라는 문제입니다.


일단 문제를 보면 그렇게 어렵지 않다는 것을 알수 있습니다.




<코 드>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.Scanner;
 
public class Beak2490 {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
        int[] array = new int[4];
        int count = 0;
 
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < array.length; j++) {
                array[i] = sc.nextInt();
 
                if (array[i] == 1) { // 1 == 등 , 0 == 배  
                    count++;
                }
            }
            switch (count) {
            case 0:
                System.out.println("D");
                break;
            case 1:
                System.out.println("C");
                break;
            case 2:
                System.out.println("B");
                break;
            case 3:
                System.out.println("A");
                break;
            case 4:
                System.out.println("E");
                break;
            }
            count = 0;
        }
    }
}
 
cs


반응형
사업자 정보 표시
난길샵 | 박현숙 | 경상북도 성주군 월항면 수죽길 98길 | 사업자 등록번호 : 256-07-01668 | TEL : 010-9909-8420 | Mail : skr04@naver.com | 통신판매신고번호 : 제2020-경북성주-52호 | 사이버몰의 이용약관 바로가기

댓글