Advertisement
artemgf

Stripies

Apr 29th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. #include <math.h>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <set>
  8. #include <map>
  9. #include <sstream>
  10. #include <queue>
  11.  
  12. using namespace std;
  13.  
  14. int main()
  15. {
  16.     double n, P, prom;
  17.     vector <double> s;
  18.     cin >> n;
  19.    
  20.     cout.setf(ios::fixed);
  21.     cout.precision(2);
  22.     for (int i = 1; i <= n; i++)
  23.     {
  24.         cin >> prom;
  25.         s.push_back(prom);
  26.     }
  27.  
  28.     sort(s.begin(), s.end());
  29.     P = s[s.size() - 1];
  30.  
  31.     for (int i = s.size() - 2; i >= 0; i--)
  32.         P = 2 * sqrt(P*s[i]);
  33.  
  34.     cout << P;
  35.  
  36.     _getch();
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement