Pagini recente » Cod sursa (job #1049467) | Cod sursa (job #1559105) | Cod sursa (job #462665) | Cod sursa (job #2495636) | Cod sursa (job #2931542)
#include <bits/stdc++.h>
using namespace std;
const int nmax = 1e5 + 7;
static int n;
static int a[nmax][2];
static double p[nmax][2];
double solve() {
double mnx = INFINITY;
double mxx = -INFINITY;
double mny = INFINITY;
double mxy = -INFINITY;
for (int i = 0; i < n; i++) {
mnx = min(mnx, p[i][0]);
mxx = max(mxx, p[i][0]);
mny = min(mny, p[i][1]);
mxy = max(mxy, p[i][1]);
}
return (mxx - mnx) * (mxy - mny);
}
int main() {
#ifdef LOCAL
freopen("file.in", "r", stdin);
#else
freopen("rubarba.in", "r", stdin);
freopen("rubarba.out", "w", stdout);
#endif
ios_base::sync_with_stdio(false), cin.tie(NULL);
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1];
double ans = INFINITY;
for (double ang = 0; ang < M_PI * 2.0; ang += 0.125) {
for (int i = 0; i < n; i++) {
p[i][0] = a[i][0] * cos(ang) - a[i][1] * sin(ang);
p[i][1] = a[i][1] * cos(ang) + a[i][0] * sin(ang);
}
ans = min(ans, solve());
}
cout << setprecision(2) << fixed << ans;
}