[백준] 2480 : 주사위 세개 - Java

길 잃은 까마귀·2022년 9월 13일
0

https://www.acmicpc.net/problem/2480


  • 문제

  • 풀이
    옛날에 공부하기 초반에 했던 문제라 그런지 지금보면 더 깔끔하게 할수도 있겠다는 생각이 든다. 문제에 적힌 조건을 그대로 적으면 되는 문제이다.

  • 코드
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if ((a == b) && (b == c))
			System.out.println(10000 + a * 1000);
		else if (a == b)
			System.out.println(1000 + a * 100);
		else if (c == b)
			System.out.println(1000 + b * 100);
		else if (a == c)
			System.out.println(1000 + a * 100);
		else {
			if ((a > c) && (a > b))
				System.out.println(a * 100);
			if ((b > c) && (b > a))
				System.out.println(b * 100);
			if ((c > a) && (c > b))
				System.out.println(c * 100);
		}
	}
}
profile
코딩 고수가 될 사람

0개의 댓글