Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using LL = long long;
- const long double PI = acos(-1.0);
- struct PT { LL x, y; };
- struct V
- {
- LL x, y;
- V(LL _x=0, LL _y=0): x(_x), y(_y) { }
- V(PT p): x(p.x), y(p.y) { }
- V(PT p1, PT p2): x(p2.x-p1.x), y(p2.y-p1.y) {}
- LL operator*(V v2)
- {
- return x * v2.x + y * v2.y;
- }
- LL operator%(V v2)
- {
- return x * v2.y - y * v2.x;
- }
- long double len()
- {
- return hypot(x, y); // sqrt(x*x + y*y)
- }
- };
- long double fi(V v1, V v2)
- {
- return atan2(v1 % v2, v1 * v2); // -pi ... pi
- }
- istream& operator>>(istream& in, PT& p)
- {
- in >> p.x >> p.y;
- return in;
- }
- ostream& operator<<(ostream& out, V v)
- {
- out << v.x << ' ' << v.y;
- return out;
- }
- int main()
- {
- #ifdef AZHUKOV
- freopen("input.txt", "r", stdin);
- #endif // AZHUKOV
- PT A, B;
- cin >> A >> B;
- V AB(A,B);
- cout << AB;
- // OA.operator*(OB)
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement