-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1963.cpp
More file actions
83 lines (80 loc) · 2.42 KB
/
1963.cpp
File metadata and controls
83 lines (80 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define FOR0(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define FOR(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define FORD(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define repi(i,a) for(__typeof((a).begin()) i=(a).begin(), _##i=(a).end(); i!=_##i; ++i)
#define dwni(i,a) for(__typeof((a).rbegin()) i=(a).rbegin(), _##i=(a).rend(); i!=_##i; ++i)
#define SZ(a) ((int)((a).size()))
#define printCase() "Case #" << caseNum << ": "
#define pb push_back
#define mp make_pair
#define EPS (1e-9)
#define PI 3.1415926535
#define INF ((int)1e9)
#define SYNC std::ios::sync_with_stdio(false); cin.tie(NULL);
#define ff first
#define ss second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
struct point {
double x, y;
point() {x = y = 0.0;}
point(double _x, double _y) : x(_x), y(_y) {}
bool operator < (point other) const {
if(abs(x - other.x) > EPS)
return x < other.x;
else return y < other.y;
}
bool operator == (point other) const {
return abs(x - other.x) <= EPS && abs(y - other.y) <= EPS;
}
};
// euclidean distance
double dist(point p1, point p2) { return hypot(p1.x - p2.x, p1.y - p2.y);}
// cw rotation of angle theta about origin
point rotate(point p, double theta) {
double rad = theta * PI / 180;
return point(p.x * cos(rad) - p.y * sin(rad), p.x * sin(rad) + p.y * cos(rad));
}
// ax + by + c = 0
struct line {
double a, b, c;
};
line pointsToLine(point p1, point p2) {
line l;
if(abs(p1.x - p2.x) < EPS) {
l.a = 1.0; l.b = 0.0; l.c = - p1.x;
} else {
l.a = -(double)(p1.y - p2.y) / (p1.x - p2.x);
l.b = 1.0;
l.c = -(double)(l.a * p1.x) - p1.y;
}
return l;
}
bool areParallel(line l1, line l2 ) {
return abs(l1.a - l2.a) < EPS && abs(l2.b - l1.b) < EPS;
}
bool sameLine(line l1, line l2) {
return areParallel(l1, l2) && abs(l1.c - l2.c) < EPS;
}
long double lineDist(line l, point p) {
return (l.a*p.x + l.b * p.y + l.c) / (l.a*l.a + l.b*l.b);
}
int main() {
SYNC
point p[4];
FOR0(i, 4) cin >> p[i].x >> p[i].y;
int ans = 0;
FOR0(i, 4) {
FOR0(j, i) {
point mid = point((p[i].x + p[j].x)/2, (p[i].y + p[j].y)/2);
}
}
}