CF280A.Rectangle Puzzle

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are parallel to the coordinate axes: the length of the side that is parallel to the Ox axis, equals w, the length of the side that is parallel to the Oy axis, equals h. The second rectangle can be obtained by rotating the first rectangle relative to the origin of coordinates by angle α.

Your task is to find the area of the region which belongs to both given rectangles. This region is shaded in the picture.

平面上给出两个矩形。这两个矩形的中心均位于坐标原点(即矩形的对称中心)。第一个矩形的边分别与坐标轴平行:与 OxOx 轴平行的边长为 ww,与 OyOy 轴平行的边长为 hh。第二个矩形可由第一个矩形绕坐标原点旋转角度 α\alpha 得到。

你的任务是求出同时属于这两个矩形的区域的面积。图中阴影部分即为此公共区域。

输入格式

The first line contains three integers w, h, α (1 ≤ w, h ≤ 106; 0 ≤ α ≤ 180). Angle α is given in degrees.

第一行包含三个整数 ww、hh、α\alpha(1≤w,h≤1061 \leq w, h \leq 10^6;0≤α≤1800 \leq \alpha \leq 180)。角度 α\alpha 以度为单位给出。

输出格式

In a single line print a real number — the area of the region which belongs to both given rectangles.

The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 6.

在一行中输出一个实数——两个给定矩形的公共区域的面积。

若答案的相对误差或绝对误差不超过 10−610^{-6},则视为正确。

输入输出样例

  • 输入#1

    1 1 45

    输出#1

    0.828427125
  • 输入#2

    6 4 30

    输出#2

    19.668384925

说明/提示

The second sample has been drawn on the picture above.

第二个样例已在上图中绘制。

输入解题思路,AI测评打分。不知道怎么写?

首页