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"); + + } + +} + +```