Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- const long double PI = 3.14159265;
- struct Vec {
- long double x, y;
- Vec norm() const {
- return { x / len(), y / len() };
- }
- Vec operator+ (const Vec &rhs) const {
- return {x + rhs.x, y + rhs.y};
- }
- Vec operator- (const Vec &rhs) const {
- return { x - rhs.x, y - rhs.y };
- }
- long double operator% (const Vec & rhs) const {
- return x * rhs.x + y * rhs.y;
- }
- long double operator^ (const Vec & rhs) const {
- return x * rhs.y - rhs.x * y;
- }
- template <typename T>
- Vec operator*(T rhs) const {
- return { x * rhs, y * rhs };
- }
- template <typename T>
- Vec operator/(T rhs) const {
- return { x / rhs, y / rhs };
- }
- long long len2() const {
- return 1LL * x * x + 1LL * y * y;
- }
- long double len() const {
- return sqrt(x * x + y * y);
- }
- };
- long double get_angle(Vec v1, Vec v2) {
- return atan2(v1 ^ v2, v1 % v2);
- }
- int main() {
- //freopen("goat1.in", "r", stdin);
- //freopen("goat1.out", "w", stdout);
- Vec p1, p2, p3, p4;
- cin >> p1.x >> p1.y;
- cin >> p2.x >> p2.y;
- cin >> p3.x >> p3.y;
- cin >> p4.x >> p4.y;
- p1 = p1 - p2;
- p3 = p3 - p2;
- p4 = p4 - p2;
- long double x1 = (p4 ^ p1), x2 = (p4 ^ p3);
- if (abs((p1 % p4) / abs(p1 % p4) - (p3 % p4) / abs(p3 % p4)) < 0.00000001) {
- cout << "YES";
- }
- else {
- cout << "NO";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement