Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double dist (double a, double b, double c, double d)
- {
- return sqrt((a-c)*(a-c) + (b-d)*(b-d));
- }
- double upcirc(double x)
- {
- return 1 + sqrt(4 - (x + 1)*(x + 1));
- }
- double downcirc(double x)
- {
- return 1 - sqrt(4 - (x + 1)*(x + 1));
- }
- double negline(double x)
- {
- return -x;
- }
- double posline(double x)
- {
- return 2*x + 2;
- }
- bool IsPointInArea (double &x, double &y)
- {
- return (y >= posline(x) && y >= negline(x) && y <= upcirc(x)) || (y <= posline(x) && y <= negline(x) && y <= downcirc(x));
- }
- int main() {
- double x = 0.0, y = 0.0;
- cin >> x >> y ;
- if (IsPointInArea(x, y))
- cout << "YES" << endl;
- else cout << "NO" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement