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.

Input

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

Output

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.

Examples

Input

1 1 45

Output

0.828427125

Input

6 4 30

Output

19.668384925

Note

The second sample has been drawn on the picture above.

思路:

根据对称性,

我们把矩阵转化为w>=h 形状的。

又根据对称性,

如果角度a是钝角,可以把a变为与a互补的锐角,不影响答案值。

如图所示,我们只需要三角形1和2的面积就可以求的阴影部分面积,

那么根据绿色的线我们可以得出

x+z+t=w

根据紫色的线我们可以的出:

y+v+u=h

而根据三角形关系

我们可以得到 x,y与z的关系,u,t与v的关系。

两个方程,两个未知量(z,v)可以求出z和v,从而可以得出答案。

还有一个需要特殊判断的情况是:

这种阴影部分的面积是一个蓝色的菱形,那么我们根据粉红色区域的三角形关系可以的出答案。

细节见代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) {ll ans = 1; while (b) {if (b % 2) { ans = ans * a % MOD; } a = a * a % MOD; b /= 2;} return ans;}
inline void getInt(int *p);
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
typedef long double ld;
ld w, h, a;
const ld pi = acos(-1);
int main()
{
//freopen("D:\\code\\text\\input.txt","r",stdin);
//freopen("D:\\code\\text\\output.txt","w",stdout);
cin >> w >> h >> a;
if (h > w) {
swap(h, w);
}
a = min(a, 180.0 - a);
a /= 180;
a *= pi;
ld z = (w - (h * sin(a)) / (1.0 + cos(a))) / (1.0 + cos(a) - sin(a) * sin(a) / (1 + cos(a)));
ld v = (h - z * sin(a)) / (1.0 + cos(a));
if (v > 0.0) {
ld x = z * cos(a);
ld y = z * sin(a);
ld ans = w * h;
ans -= x * y;
x = v * cos(a);
y = v * sin(a);
ans -= x * y;
cout << fixed << setprecision(7) << ans << endl;
} else {
v = h / sin(a);
ld x = v * cos(a / 2.0);
ld y = v * sin(a / 2.0);
ld ans = x * y * 2.0;
cout << fixed << setprecision(7) << ans << endl;
} return 0;
} inline void getInt(int *p)
{
char ch;
do {
ch = getchar();
} while (ch == ' ' || ch == '\n');
if (ch == '-') {
*p = -(getchar() - '0');
while ((ch = getchar()) >= '0' && ch <= '9') {
*p = *p * 10 - ch + '0';
}
} else {
*p = ch - '0';
while ((ch = getchar()) >= '0' && ch <= '9') {
*p = *p * 10 + ch - '0';
}
}
}

最新文章

  1. 黑马程序员——ARC机制总结和用ARC建立模型
  2. Java使用实现面向对象编程:第七章集合框架的解读=&gt;重中之重
  3. ArcGIS10的附件功能
  4. Android Studio的git功能的使用介绍
  5. Matlab2014a 提示未找到支持的编译器或 SDK的解决方法
  6. write_back 浅浅分析
  7. 通过自己技能把某个网站的ppt全部下载下来的过程
  8. (转)codeblock(常用快键)
  9. 团队项目——二手书店(NABC分析)
  10. (转载)使用ADOConnet.BeginTrans后,出现错误提示:无法在此会话中启动更多的事务?
  11. 【转】iOS-Core-Animation-Advanced-Techniques(五)
  12. 【原创】python基于大数据现实双色球预测
  13. JavaScript 中的四舍五入
  14. H264三种码率控制方法(CBR, VBR, CVBR)
  15. jmeter 压力测试
  16. pyqt5 添加属性-类方法用属性形式访问
  17. JQuery的ajax方法获取返回值得到了值还包含了不要的html源码 (Ajax相关知识)
  18. [Ynoi2018]未来日记(分块)
  19. java用while循环设计轮询线程的性能问题
  20. Sublime text 2/3 SVN插件及使用方法

热门文章

  1. DP————最小覆盖问题
  2. 使用nginx部署项目的相关资料
  3. Kafka性能调优分析-线上环境篇
  4. Reactor系列(一)基本概念
  5. 13.sqoop的安装
  6. [转帖]12条用于Linux的MySQL/MariaDB安全最佳实践
  7. drf序列化及反序列化
  8. redis发布订阅者
  9. ES6新特性总结
  10. 解决 Ubuntu 19 安装openjdk 8后与openjfx不兼容