From 9d55d177eb542f3219d1582bc0ac7963eefb1b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=88=98=EB=AF=BC?= Date: Fri, 27 Dec 2024 14:05:28 +0900 Subject: [PATCH] CT_346 --- ...\355\205\214\354\212\244\355\212\270.java" | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 "BOJ/Java/src/B2/Boj_5576_\354\275\230\355\205\214\354\212\244\355\212\270.java" diff --git "a/BOJ/Java/src/B2/Boj_5576_\354\275\230\355\205\214\354\212\244\355\212\270.java" "b/BOJ/Java/src/B2/Boj_5576_\354\275\230\355\205\214\354\212\244\355\212\270.java" new file mode 100644 index 0000000..241ba86 --- /dev/null +++ "b/BOJ/Java/src/B2/Boj_5576_\354\275\230\355\205\214\354\212\244\355\212\270.java" @@ -0,0 +1,37 @@ +package B2; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.Arrays; + +public class Boj_5576_콘테스트 { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < 2; i++) { + + int[] arr = new int[10]; + + for (int j = 0; j < 10; j++) { + arr[j] = Integer.parseInt(br.readLine()); + } + + Arrays.sort(arr); + + int sum = 0; + + for (int j = 9; j >= 7; j--) { + sum += arr[j]; + } + sb.append(sum).append(' '); + } + + bw.write(sb.toString()); + bw.flush(); + } +}