折线中点
#pragma comment(linker, "/STACK:102400000,102400000") #include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorithm> #include<iostream> #include<map> #include<queue> #include<stack> #include<string> #include<functional> #include<math.h> //#include<bits/stdc++.h> using namespace std; typedef long long lint; typedef vector<int> VI; typedef pair<int, int> PII; typedef queue<int> QI; void makedata() { freopen("input.txt", "w", stdout); fclose(stdout); } double x[200], y[200]; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif //makedata(); //std::ios::sync_with_stdio(0), cin.tie(0); int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%lf%lf", &x[i], &y[i]); double l = 0; for (int i = 1; i < n; i++) l += sqrt((x[i] - x[i - 1]) * (x[i] - x[i - 1]) + (y[i] - y[i - 1]) * (y[i] - y[i - 1])); l /= 2.0; for (int i = 1; i < n; i++) { double tmp = sqrt((x[i] - x[i - 1]) * (x[i] - x[i - 1]) + (y[i] - y[i - 1]) * (y[i] - y[i - 1])); if (l > tmp) l -= tmp; else { printf("%.1lf %.1lf\n", x[i - 1] + (l / tmp) * (x[i] - x[i - 1]), y[i - 1] + (l / tmp) * (y[i] - y[i - 1])); break; } } return 0; }