Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include<cmath>
  3. #include<fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int x, y, S, P;
  10.  
  11. ifstream in("INPUT.txt");
  12. in >> S >> P;
  13. in.close();
  14.  
  15.  
  16. x = (S + sqrt((S * S - 4 * P))) / 2;
  17. y = S - x;
  18.  
  19. ofstream out("OUTPUT.txt");
  20.  
  21. if (x<y)
  22. {
  23. out << x << " " << y;
  24. }
  25. else
  26. {
  27. out << y << " " << x;
  28. }
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement