File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ //https://www.acmicpc.net/problem/14729
2+ import java .io .BufferedReader ;
3+ import java .io .IOException ;
4+ import java .io .InputStreamReader ;
5+ import java .util .Collections ;
6+ import java .util .PriorityQueue ;
7+
8+ public class BOJ_S5_14729_칠무해 {
9+
10+ public static void main (String [] args ) throws IOException {
11+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
12+
13+ int N = Integer .parseInt (br .readLine ());
14+ PriorityQueue <Double > pq = new PriorityQueue <>(7 , Collections .reverseOrder ());
15+
16+ for (int i = 0 ; i < 7 ; i ++) {
17+ pq .add (Double .parseDouble (br .readLine ()));
18+ }
19+
20+ for (int i = 0 ; i < N -7 ; i ++) {
21+ double d = Double .parseDouble (br .readLine ());
22+
23+ if (pq .peek () > d ) {
24+ pq .poll ();
25+ pq .add (d );
26+ }
27+ }
28+
29+ double [] ans = new double [7 ];
30+ for (int i = 0 ; i < 7 ; i ++) {
31+ ans [i ] = pq .poll ();
32+ }
33+
34+ for (int i = 6 ; i >= 0 ; i --) {
35+ System .out .printf ("%.3f\n " , ans [i ]);
36+ }
37+
38+ }
39+
40+ }
You can’t perform that action at this time.
0 commit comments