include iostream include string include queue include set include stac

 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
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <stack>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#define FNAME "sentence"
using namespace std;
//const int K = 100, MAXN = 110;
//const int N = 2e6 + 10;
double ans = 1000000000;
pair <int, int> a[10];
pair<int, int> b;
double dis(pair <int, int > x, pair<int, int> y) {
return sqrt(1.0 * (x.first - y.first) * (x.first - y.first) + 1.0 * (x.first - y.first) * (x.second - y.second));
}
void solve(pair <int, int > x, pair<int, int> y, pair<int, int> z) {
ans = min(dis(x, z) + dis(y, z) - dis(x, y), ans);
}
int main() {
//#ifdef DEBUG
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
//#endif
//#ifndef DEBUG
// freopen(FNAME".in", "r", stdin);
// freopen(FNAME".out", "w", stdout);
//#endif
for (int i = 1; i <= 3; i++) {
cin >> a[i].first >> a[i].second;
}
a[4] = a[1];
cin >> b.first >> b.second;
for (int i = 1; i <= 3; i++) {
solve(a[i], a[i + 1], b);
cout << ans << endl;
}
ans = ans / 2;
ans = sqrt(ans);
cout << fixed << setprecision(9) << ans;
return 0;
}