백준 #11948번 과목선택

jhj·2024년 2월 10일

백준 JAVA

목록 보기
207/583
import java.util.Scanner;
public 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();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int f = sc.nextInt();
		int total = 0;
		
		if(a >= d && b >= d && c >= d) {
			total = a + b + c;
		}else if(a >= c && b >= c && d >= c) {
			total = a + b + d;
		}else if(a >= b && c >= b && d >= d) {
			total = a + c + d;
		}else {
			total = b + c + d;
		}
		
		if(e >= f) {
			total += e;
		}else {
			total += f;
		}
		
		System.out.println(total);
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글