Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- //#pragma GCC optimize("O3")
- //#pragma GCC optimize("unroll-loops")
- #define mp make_pair
- #define pb push_back
- #define eb emplace_back
- #define x first
- #define y second
- #define sz(x) (int)x.size()
- #define all(x) begin(x), end(x)
- #define rall(x) rbegin(x), rend(x)
- #define FOR(i,a,b) for (int i = (a); i < (b); i++)
- #define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
- using namespace std;
- typedef unsigned long long ull;
- typedef long long ll;
- typedef long double ld;
- typedef pair<int, int> pi;
- typedef pair<ld, ld> pld;
- typedef pair<ll, ll> pl;
- typedef vector<int> veci;
- typedef vector<bool> vecb;
- typedef vector<vector<int>> vvi;
- typedef vector<vector<bool>> vvb;
- const int INF_I = 1e9;
- const ll INF_LL = 1e18;
- const int MOD = 1000000007;
- const double eps = 1e-6;
- ld s(pld a, pld b){
- return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
- }
- ld len(pld a){
- return sqrt(a.x*a.x+a.y*a.y);
- }
- int main() {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- pi a, b, c;
- cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
- pld ab = {(b.x-a.x), b.y-a.y};
- ab = {ab.x/len(ab), ab.y/len(ab)};
- pld ac = {c.x-a.x, c.y-a.y};
- ac = {ac.x/len(ac), ac.y/len(ac)};
- pld a1 = {(2*a.x + ab.x + ac.x)/2, (2*a.y + ab.y + ac.y)/2};
- pld ba = {-ab.x, -ab.y};
- pld bc = {(c.x-b.x), c.y-b.y};
- bc = {bc.x/len(bc), bc.y/len(bc)};
- pld b1 = {(2*b.x + ba.x + bc.x)/2, (2*b.y + ba.y + bc.y)/2};
- ld A1 = a.y-a1.y;
- ld B1 = a1.x-a.x;
- ld C1 = -(A1*a.x+B1*a.y);
- ld A2 = b.y-b1.y;
- ld B2 = b1.x-b.x;
- ld C2 = -(A2*b.x+B2*b.y);
- ld xx = -(C1 * B2 - C2 * B1) / (A1*B2-A2*B1);
- ld yy = -(A1*C2-A2*C1)/(A1*B2-A2*B1);
- cout << fixed << xx << " " << yy << "\n";
- return 0;
- }
Add Comment
Please, Sign In to add comment