hdu-1593 find a way to escape(贪心,数学)

思路:两个人都要选取最优的策略。

先求外层那个人的角速度,因为他的角速度是确定的,再求内层人的当角速度和外层人一样时的对应的圆的半径r1。外层圆的半径为d;

那么如果r1>=外围圆的半径,那么肯定能逃脱,因为在d内层人的角速度比外层人的快,所以最多能与外层人相距半个圆周。

如多r1<d时,在0-r1内层角速度快,所以和可在r1圆周过圆心和外层人相对,此时两人的夹角为180,那么此时内层人必须沿直线走到外层圆周上,因为如果不的话,因为角速度小于外层,所以外层的人可以缩小角间距,所以更容易被抓。最后只要判断当沿直线走的时间t1是否小于外层人走半圆的时间。小于就能逃。

 1 #include<stdio.h>
 2 #include<algorithm>
 3 #include<iostream>
 4 #include<stdlib.h>
 5 #include<string.h>
 6 #include<string.h>
 7 #include<math.h>
 8 const double N=3.141592654;
 9 typedef long long ll;
10 int a[100005];
11 using namespace std;
12 int main(void)
13 {
14     int n,i,j,k,p,q;
15     while(cin>>k>>p>>q)
16     {
17         double x1,x2,x3;
18         x2=1.0*q/k;
19         double r2=1.0*p/x2;//求与外层人相同角速度的同心圆半径。
20         if(r2<1.0*k)
21         {
22             double c=1.0*k-r2;
23             double t=c/p;//沿直线走的时间
24             double t2=N*k/q;//走半圆所用的时间
25             if(t<t2)
26             {
27                 cout<<"Yes"<<endl;
28             }
29             else cout<<"No"<<endl;
30         }
31         else
32         {
33             cout<<"Yes"<<endl;
34         }
35     }
36     return 0;
37 }

 

posted @ 2015-11-13 13:37  sCjTyC  阅读(490)  评论(0编辑  收藏  举报