Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <algorithm>
- #include <cstdio>
- #include <cstdlib>
- #include <string>
- #include <cstring>
- using namespace std;
- int main () {
- #ifndef ONLINE_JUDGE
- freopen ("input.txt", "r", stdin);
- freopen ("output.txt", "w", stdout);
- #endif
- int x, y, x1, y1, x2, y2;
- scanf ("%d%d", &x, &y); // x - x1 / x2 - x1 = y - y1 / y2 - y1
- scanf ("%d%d%d%d", &x1, &y1, &x2, &y2);
- double AB = sqrt ((double) (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- double AO = sqrt ((double) (x - x1) * (x - x1) + (y - y1) * (y - y1));
- double OB = sqrt ((double) (x - x2) * (x - x2) + (y - y2) * (y - y2));
- // cout << AB << " " << AO << " " << OB << "\n";
- if (! (round (AO) + round (OB) == round (AB)))
- {
- printf ("NO");
- exit (0);
- }
- // cout << "ok";
- if (y2 - y1 == 0 && x2 - x1 == 0 || x - x1 == 0 || y - y1 == 0)
- {
- printf ("YES");
- exit (0);
- }
- else if (! (y2 - y1 == 0 && x2 - x1 == 0) && (x2 - x1 == 0 || y2 - y1 == 0))
- {
- printf ("NO");
- exit (0);
- }
- // cout << "ok";
- double a = (x - x1) / (x2 - x1);
- double b = (y - y1) / (y2 - y1);
- // cout << a << " " << b << "\n";
- if (a == b)
- printf ("YES");
- else printf ("NO");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement