Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <algorithm>
- #include <stdio.h>
- using namespace std;
- bool comp(int& x1, int& x2)
- {
- return x1 < x2;
- }
- int main() {
- std::ifstream fin("input.txt");
- std::ofstream fout("output.txt");
- int n;
- fin >> n;
- vector<int> m(n);
- for (int i = 0; i < n; i++) {
- fin >> m[i];
- }
- sort(m.begin(), m.end(), comp);
- double g;
- fin >> g;
- for (int i = 0; i < n; i++) {
- if (g < m[i]) {
- g += m[i];
- g /= 2;
- }
- }
- fout << fixed;
- fout.precision(6);
- fout << g;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment