Input The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of points…
- User
Input
The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of points on a plane.
Each of the next n lines contains two real coordinates xi and yi of the point, specified with exactly 2 fractional digits. All coordinates are between - 1000 and 1000, inclusive.
Output
Output a single real number θ — the answer to the problem statement. The absolute or relative error of your answer should be at most 10 - 2.
Examples
Input
8 -2.14 2.06 -1.14 2.04 -2.16 1.46 -2.14 0.70 -1.42 0.40 -0.94 -0.48 -1.42 -1.28 -2.16 -1.62
Output
5.410
Input
5 2.26 1.44 2.28 0.64 2.30 -0.30 1.58 0.66 3.24 0.66
Output
5.620
Input
8 6.98 2.06 6.40 1.12 5.98 0.24 5.54 -0.60 7.16 0.30 7.82 1.24 8.34 0.24 8.74 -0.76
Output
5.480
Input
5 10.44 2.06 10.90 0.80 11.48 -0.48 12.06 0.76 12.54 2.06
Output
6.040
Input
8 16.94 2.42 15.72 2.38 14.82 1.58 14.88 0.50 15.76 -0.16 16.86 -0.20 17.00 0.88 16.40 0.92
Output
6.040
Input
7 20.62 3.00 21.06 2.28 21.56 1.36 21.66 0.56 21.64 -0.52 22.14 2.32 22.62 3.04
Output
6.720
Assistant
import math def convex_hull(points): points = sorted(points) lower = [] for p in points: while len(lower) >= 2 and cross(lower[-2], lower[-1], p) <= 0: lower.pop() lower.append(p) upper = [] for p in reversed(points): while len(upper) >= 2 and cross(upper[-2], upper[-1], p) <= 0: upper.pop() upper.append(p) return lower[:-1] + upper[:-1] def cross(o, a, b): return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]) def area(hull): if len(hull) < 3: return 0.0 a = 0.0 n = len(hull) for i in range(n): x1, y1 = hull[i] x2, y2 = hull[(i+1)%n] a += (x1 * y2 - x2 * y1) return abs(a) / 2.0 def rotate_points(points, theta_degrees): theta = math.radians(theta_degrees) c = math.cos(theta) s = math.sin(theta) rotated = [] for x, y in points: x_new = x * c - y * s y_new = x * s + y * c rotated.append((x_new, y_new)) return rotated n = int(input()) points = [tuple(map(float, input().split())) for _ in range(n)] best_area = -1.0 best_theta = 0.0 # Coarse search with 1-degree steps for theta_deg in range(180): rotated = rotate_points(points, theta_deg) hull = convex_hull(rotated) current_area = area(hull) if current_area > best_area: best_area = current_area best_theta = theta_deg # Fine search around the best theta from coarse search start = max(0.0, best_theta - 0.5) end = min(179.9999, best_theta + 0.5) start_fine = int(round(start * 100)) end_fine = int(round(end * 100)) for theta_int in range(start_fine, end_fine + 1): theta_deg = theta_int / 100.0 rotated = rotate_points(points, theta_deg) hull = convex_hull(rotated) current_area = area(hull) if current_area > best_area: best_area = current_area best_theta = theta_deg print("{0:.3f}".format(best_theta))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.