From c74686148553471ad8ad84cb886fabf972f58462 Mon Sep 17 00:00:00 2001 From: oncsr Date: Fri, 14 Mar 2025 15:53:57 +0900 Subject: [PATCH] =?UTF-8?q?[20250314]=20BOJ=20/=20G5=20/=20=EB=82=9C?= =?UTF-8?q?=EB=A1=9C=20/=20=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../14 BOJ G5 \353\202\234\353\241\234.md" | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 "khj20006/202503/14 BOJ G5 \353\202\234\353\241\234.md" diff --git "a/khj20006/202503/14 BOJ G5 \353\202\234\353\241\234.md" "b/khj20006/202503/14 BOJ G5 \353\202\234\353\241\234.md" new file mode 100644 index 00000000..1b61d0cc --- /dev/null +++ "b/khj20006/202503/14 BOJ G5 \353\202\234\353\241\234.md" @@ -0,0 +1,63 @@ +```java + +import java.util.*; +import java.io.*; + +class Main { + + // IO field + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() throws Exception { + if(!st.hasMoreTokens()) nextLine(); + return Integer.parseInt(st.nextToken()); + } + static long nextLong() throws Exception { + if(!st.hasMoreTokens()) nextLine(); + return Long.parseLong(st.nextToken()); + } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int N, K, ans = 0; + static PriorityQueue Q; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + K = nextInt(); + Q = new PriorityQueue<>(); + int prev = nextInt(), now = 0; + + for(int i=1;iK;i--) ans += Q.poll(); + bw.write(ans + "\n"); + + } + +} + +```