Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const double centerX = 0;
- const double centerY = 0;
- bool CheckFirstFigure(double x, double y);
- int main()
- {
- double x, y;
- cin >> x >> y;
- if (CheckFirstFigure(x, y))
- {
- cout << "Black";
- }
- else if (abs((x - centerX)*(x - centerX) + (y - centerY) * (y - centerY) - 4.0) < 0.01)
- {
- cout << "Undefined";
- }
- else if (abs((x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) - 9.0) < 0.01)
- {
- cout << "Undefined";
- }
- else if ((x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) > 4.0 && (x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) < 9.0)
- {
- cout << "Black";
- }
- else if ((x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) < 4.0 && !(CheckFirstFigure(x, y)))
- {
- cout << "White";
- }
- else
- {
- cout << "Outside";
- }
- return 0;
- }
- bool CheckFirstFigure(double x, double y)
- {
- if ((x >= -1.0 && x <= 1.0) && abs(y - 1.0) < 0.001)
- {
- return true;
- }
- else if ((y >= -1.0 && y <= 1.0) && abs(x - 1.0) < 0.001)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement