Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- double x, y;
- cin >> x >> y;
- bool is_in_square, is_on_square;
- if (x > -4 && x < 4 && y > -4 && y < 4)
- {
- is_in_square = 1;
- }
- else
- {
- is_in_square = 0;
- }
- bool is_in_big_circle = x * x + y * y - 16 < DBL_EPSILON;
- bool is_in_medium_left_circle = (x + 2) * (x + 2) + y * y - 4 < DBL_EPSILON;
- bool is_in_medium_right_circle = (x - 2) * (x - 2) + y * y - 4 < DBL_EPSILON;
- bool is_in_small_left_circle = (x + 2) * (x + 2) + y * y - 1 < DBL_EPSILON;
- bool is_in_small_right_circle = (x - 2) * (x - 2) + y * y - 1 < DBL_EPSILON;
- bool is_on_big_circle = x * x + y * y == 16;
- bool is_on_medium_left_circle = (x + 2) * (x + 2) + y * y == 4 && y > 0;
- bool is_on_medium_right_circle = (x - 2) * (x - 2) + y * y == 4 && y < 0;
- bool is_on_small_left_circle = (x + 2) * (x + 2) + y * y == 1;
- bool is_on_small_right_circle = (x - 2) * (x - 2) + y * y == 1;
- if (x == -4 || x == 4 || y == 4 || y == -4)
- {
- is_on_square = 1;
- }
- else
- {
- is_on_square = 0;
- }
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- if (is_on_square == 1 || is_on_big_circle == 1 || is_on_medium_left_circle == 1 || is_on_medium_right_circle == 1 || is_on_small_left_circle == 1 || is_on_small_right_circle == 1)
- {
- cout << "Undefined";
- }
- else
- {
- if (is_in_square == 1)
- {
- if (is_in_big_circle == 1)
- {
- if (y > 0 && (is_in_medium_left_circle == 0 || is_in_small_left_circle == 1) && is_in_small_right_circle == 0)
- {
- cout << "White";
- }
- else if (y > 0 && (is_in_medium_left_circle == 1 || is_in_small_left_circle == 0) && is_in_small_right_circle == 1)
- {
- cout << "Black";
- }
- else if (y < 0 && (is_in_medium_right_circle == 0 || is_in_small_right_circle == 1) && is_in_small_left_circle == 0)
- {
- cout << "Black";
- }
- else if (y < 0 && (is_in_medium_right_circle == 1 || is_in_small_right_circle == 0) && is_in_small_left_circle == 1)
- {
- cout << "White";
- }
- }
- else
- {
- cout << "White";
- }
- }
- else
- {
- cout << "Outside";
- }
- }
- return main();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement