Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <array>
- #include <cassert>
- #include <climits>
- #include <cmath>
- #include <cstring>
- #include <iomanip>
- #include <iostream>
- #include <limits>
- #include <list>
- #include <map>
- #include <numeric>
- #include <queue>
- #include <set>
- #include <sstream>
- #include <stack>
- #include <string>
- #include <tuple>
- #include <unordered_map>
- #include <unordered_set>
- #include <vector>
- #define all(x) x.begin(), x.end()
- using namespace std;
- using ll = long long;
- using ld = long double;
- const double eps = 1e-10;
- const int mod = 1000000007;
- struct Point { ld x; ld y; };
- struct Vector { ld x; ld y; };
- ld Len(const Vector& v) { return hypot(v.x, v.y); }
- ld SqLen(const Vector& v) { return v.x * v.x + v.y * v.y; }
- ld Distance(const Point& lhs, const Point& rhs) { return Len(rhs - lhs); }
- Vector operator-(const Vector& v) { return {-v.x, -v.y}; }
- Vector operator+(const Vector& lhs, const Vector& rhs) { return {lhs.x + rhs.x, lhs.y + rhs.y}; }
- Vector operator-(const Vector& lhs, const Vector& rhs) { return {lhs.x - rhs.x, lhs.y - rhs.y}; }
- Vector operator-(const Point& lhs, const Point& rhs) { return {lhs.x - rhs.x, lhs.y - rhs.y}; }
- Point operator+(const Point& lhs, const Vector& rhs) { return {lhs.x + rhs.x, lhs.y + rhs.y}; }
- Point operator-(const Point& lhs, const Vector& rhs) { return {lhs.x - rhs.x, lhs.y - rhs.y}; }
- Vector operator*(ld c, const Vector& v) { return {c * v.x, c * v.y}; }
- Vector operator*(const Vector& v, ld c) { return {c * v.x, c * v.y}; }
- Vector operator/(const Vector& v, ld c) { return {v.x / c, v.y / c}; }
- istream& operator>>(istream& in, Point& p) { return in >> p.x >> p.y; }
- istream& operator>>(istream& in, Vector& v) { return in >> v.x >> v.y; }
- ostream& operator<<(ostream& out, const Point& p) { return out << p.x << " " << p.y; }
- ostream& operator<<(ostream& out, const Vector& v) { return out << v.x << " " << v.y; }
- ld DotProduct(const Vector& lhs, const Vector& rhs) { return lhs.x * rhs.x + lhs.y * rhs.y; }
- ld CrossProduct(const Vector& lhs, const Vector& rhs) { return lhs.x * rhs.y - lhs.y * rhs.x; }
- Vector Normalize(const Vector& v) { return v / Len(v); }
- Vector Rotate(const Vector& v, ld alpha) { return {v.x * cos(alpha) - v.y * sin(alpha), v.x * sin(alpha) + v.y * cos(alpha)}; }
- int main() {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- Point a, b; cin >> a >> b;
- cout << b - a << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment