您的位置:首页 > 产品设计 > UI/UE

【数学】 HDU 1110 Equipment Box

2014-04-22 17:40 477 查看
WA了很多遍,很多遍。。。只要把输入改成double就对了。。无语凝噎。。。

#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
using namespace std;
#define PI 2 * asin(1.0)

int main()
{
int t;
scanf("%d", &t);
while(t--)
{
double n, m, x, y;
scanf("%lf%lf%lf%lf", &n, &m, &x, &y);
if(n < m) swap(n, m);
if(x < y) swap(x, y);
if(n * m <= x * y)
{
puts("Box cannot be dropped.");
continue;
}
if(n > x && m > y)
{
puts("Escape is possible.");
continue;
}
if(m <= y)
{
puts("Box cannot be dropped.");
continue;
}
double z = sqrt(x * x + y * y);
double jj = asin(m / z) - asin(y / z);
double L = x * cos(jj) + y * sin(jj);
if(L > n) puts("Box cannot be dropped.");
else puts("Escape is possible.");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  hdu C++ acm 数学