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 | import java.util.Scanner; public class Main { public static void main(String[] args) { final int DC = 50; Scanner sc = new Scanner(System.in); int hamburger1 = sc.nextInt(); int hamburger2 = sc.nextInt(); int hamburger3 = sc.nextInt(); int coke = sc.nextInt(), cider = sc.nextInt(); int set1 = 0, set2 = 0, set3 = 0; set1 = (hamburger1+coke-DC < hamburger1+cider-DC) ? hamburger1+coke-DC : hamburger1+cider-DC; set2 = (hamburger2+coke-DC < hamburger2+cider-DC) ? hamburger2+coke-DC : hamburger2+cider-DC; set3 = (hamburger3+coke-DC < hamburger3+cider-DC) ? hamburger3+coke-DC : hamburger3+cider-DC; if ((set1 < set2) && (set1 < set3)) System.out.println(set1); else if ((set2 < set1) && (set2 < set3)) System.out.println(set2); else System.out.println(set3); } } | cs |
프로그래밍 문제/백준