HDU1110 几何

题意:求能否把一个矩形放入另一个矩形中。

只有两种情况 见代码

View Code
 1 #include<stdio.h>
 2 #include<string.h>
 3 #include<stdlib.h>
 4 #include<math.h>
 5 #include<algorithm>
 6 using namespace std;
 7 const double pi=acos(-1.0);
 8 int main(){
 9     int t;
10     //printf("%lf\n",pi);
11     scanf("%d",&t);
12     while( t-- ){
13         double a,b,x,y;
14         scanf("%lf%lf%lf%lf",&a,&b,&x,&y);
15         if( a<b ) swap( a,b );
16         if( x<y ) swap( x,y );
17         bool flag=false;
18         if( a>x&&b>y )
19             flag=true;
20         else 
21             if( x>=a&&y<b ){
22             double tx,ty;
23             for( double i=0;i<=90;i+=0.1 ){
24                 double cc=i*pi/180.0;
25                 tx=x*cos( cc )+y*sin( cc );
26                 ty=x*sin( cc )+y*cos( cc );
27                 if( tx<a&&ty<b ){
28                     flag=true;
29                     break;
30                 }
31             }
32         }
33         if( flag==true )
34             printf("Escape is possible.\n");
35         else
36             printf("Box cannot be dropped.\n");
37     }
38     return 0;
39 }

 

转载于:https://www.cnblogs.com/xxx0624/archive/2013/02/07/2908639.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值