Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <fstream>
  2. #include <iomanip>
  3. #include <queue>
  4.  
  5. using namespace std;
  6. ifstream f("dstar.in");
  7. ofstream g("dstar.out");
  8. int r,p,i,n;
  9. double u,s,x;
  10. priority_queue<double> v;
  11. int main()
  12. {
  13.     f>>r>>p;
  14.     for(i=1;i<=r;i++)
  15.     {
  16.         f>>u;
  17.         s+=u;
  18.         v.push(u);
  19.     }
  20.     v.push(360-s);
  21.     for(i=1;i<=p;i++)
  22.     {
  23.         x=v.top();
  24.         v.pop();
  25.         v.push(x/2);
  26.         v.push(x/2);
  27.     }
  28.     x=v.top();
  29.     g<<fixed<<setprecision(6)<<x;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement