Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include<math.h>
- using namespace std;
- class Coordinates
- {
- public:
- Coordinates() {}
- double x;
- double y;
- Coordinates(double x, double y)
- {
- this->x = x;
- this->y = y;
- }
- };
- class Hamster :public Coordinates
- {
- public:
- Hamster(double x, double y):Coordinates(x, y) {}
- };
- class Dog :public Coordinates
- {
- public:
- Dog(double x, double y) :Coordinates(x, y) {}
- };
- class Den:public Coordinates
- {
- public:
- Den() {};
- Den(double x, double y) :Coordinates(x, y) {}
- };
- int main()
- {
- double x1, y1, x2, y2, n,x,y;
- int g = 0;
- cin >> x1 >> y1 >> x2 >> y2 >> n;
- Hamster FastHamster(x1, y1);
- Dog AgryDog(x2,y2);
- for (int i = 0; i < n; i++)
- {
- cin >> x >> y;
- if (sqrtl(pow((FastHamster.x - x), 2) + pow((FastHamster.y - y), 2))<=(sqrtl(pow((AgryDog.x - x), 2) + pow((AgryDog.y - y), 2)) / 2)&&g==0 ) {
- cout << i+1;
- g++;
- break;
- }
- }
- if(g==0)cout << "NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement