Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. double dist (double a, double b, double c, double d)
  6. {
  7.     return sqrt((a-c)*(a-c) + (b-d)*(b-d));
  8. }
  9.  
  10. double upcirc(double x)
  11. {
  12.     return 1 + sqrt(4 - (x + 1)*(x + 1));
  13. }
  14.  
  15. double downcirc(double x)
  16. {
  17.     return 1 - sqrt(4 - (x + 1)*(x + 1));
  18. }
  19.  
  20. double negline(double x)
  21. {
  22.     return -x;
  23. }
  24.  
  25. double posline(double x)
  26. {
  27.     return 2*x + 2;
  28. }
  29.    
  30. bool IsPointInArea (double &x, double &y)
  31. {
  32.     return (y >= posline(x) && y >= negline(x) && y <= upcirc(x)) || (y <= posline(x) && y <= negline(x) && y <= downcirc(x));
  33. }
  34.  
  35. int main() {
  36.    
  37.     double x = 0.0, y = 0.0;
  38.     cin >> x >> y ;
  39.    
  40.     if (IsPointInArea(x, y))
  41.         cout << "YES" << endl;
  42.     else cout << "NO" << endl;
  43.    
  44.   return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement