File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 743
743
| 49 | [ 평행선] ( https://www.acmicpc.net/problem/2358 ) | [ cpp] ( source/2358.cpp ) | 50 | [ 괄호 끼워넣기] ( https://www.acmicpc.net/problem/11899 ) | [ cpp] ( source/11899.cpp ) |
744
744
| 51 | [ 천재 수학자 성필] ( https://www.acmicpc.net/problem/15815 ) | [ cpp] ( source/15815.cpp ) | 52 | [ 파일 정리] ( https://www.acmicpc.net/problem/20291 ) | [ cpp] ( source/20291.cpp ) |
745
745
| 53 | [ Olympiad Pizza] ( https://www.acmicpc.net/problem/15235 ) | [ cpp] ( source/15235.cpp ) | 54 | [ 암기왕] ( https://www.acmicpc.net/problem/2776 ) | [ cpp] ( source/2776.cpp ) |
746
+ | 55 | [ Prosjek] ( https://www.acmicpc.net/problem/15577 ) | [ cpp] ( source/15577.cpp ) | | | |
746
747
747
748
</details >
748
749
Original file line number Diff line number Diff line change
1
+ // 15577. Prosjek
2
+ // 2022.03.14
3
+ // 자료구조
4
+ #include < iostream>
5
+ #include < queue>
6
+
7
+ using namespace std ;
8
+
9
+ int main ()
10
+ {
11
+ priority_queue<float , vector<float >, greater<float >> pq;
12
+ int n;
13
+ cin >> n;
14
+ for (int i = 0 ; i < n; i++)
15
+ {
16
+ float k;
17
+ cin >> k;
18
+ pq.push (k);
19
+ }
20
+
21
+ while (!pq.empty ())
22
+ {
23
+ if (pq.size () == 1 )
24
+ {
25
+ break ;
26
+ }
27
+ float a = pq.top ();
28
+ pq.pop ();
29
+ float b = pq.top ();
30
+ pq.pop ();
31
+
32
+ pq.push ((a + b) / 2 .0f );
33
+ }
34
+
35
+ cout << fixed;
36
+ cout.precision (6 );
37
+ cout << (float )pq.top () << endl;
38
+ return 0 ;
39
+ }
You can’t perform that action at this time.
0 commit comments