HDU 4969 Just a Joke

Just a Joke

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 89    Accepted Submission(s): 21



Problem Description
Here is just a joke, and do not take it too seriously.

Guizeyanhua is the president of ACMM, and people call him President Guizeyanhua. When Guizeyanhua is walking on the road, everyone eyes on him with admiration. Recently, Guizeyanhua has fallen in love with an unknown girl who runs along the circular race track on the playground every evening. One evening, Guizeyanhua stood in the center of the circular race track and stared the girl soulfully again. But this time he decided to catch up with the girl because of his lovesickness. He rushed to the girl and intended to show her his love heart. However, he could not run too far since he had taken an arrow in the knee.

Now your task is coming. Given the maximum distance Guizeyanhua can run, you are asked to check whether he can catch up with the girl. Assume that the values of Guizeyanhua's and the girl's velocity are both constants, and Guizeyanhua, the girl, and the center of the circular race track always form a straight line during the process. Note that the girl and Guizeyanhua can be considered as two points.

 

Input
The input begins with a line containing an integer T (T<=100000), which indicates the number of test cases. The following T lines each contain four integers V1, V2, R, and D (0<V1, V2, R, D<=10^9, V1<=V2). V1 is the velocity of the girl. V2 is the velocity of Guizeyanhua. R is the radius of the race track. D is the maximum distance President Guizeyanhua can run.
 

Output
For each case, output "Wake up to code" in a line if Guizeyanhua can catch up with the girl; otherwise output "Why give up treatment" in a line.
 

Sample Input
  
  
2 1 1 1 1 11904 41076 3561 3613
 

Sample Output
  
  
Why give up treatment Wake up to code
 

Source
 


题目链接  : http://acm.hdu.edu.cn/showproblem.php?pid=4969


题目大意  : 女神在一个圆上跑,屌丝在圆心准备去追女神,女神的速度v1,屌丝的速度为v2,速率是定值,圆的半径为R,屌丝能跑的最长距离为D,屌丝的脑子有问题追的时候保证自己和女神和圆心三点在一条直线上。问屌丝能不能追上女神



题目分析  : 因为屌丝女神和圆心在一条直线上,所以将屌丝的速度沿平行女神和垂直女神分解,由相似三角形可以得到屌丝在平行女神速度方向的分速度v2x为(v1*x) / R,所以屌丝垂直女神方向的速度由勾股定理得v2y = sqrt(v2^2 - v2x^2) = v2 * sqrt(1 - ((x*v1)/(R*v2))^2)由v2y = dx / dt (dx为屌丝垂直女神速度方向的位移) dt = dx / v2y,dx从0到R求积分得到时间t = R * arcsin(v1 / v2)  / v1,最后判断v2 * t和D的关系,v2 * t - D <= NUM则追不上输出何弃疗




#include <cstdio>
#include <cmath>
int const NUM = 1e-10;
int main()
{
    int T;
    double v1, v2, r, d, t;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%lf %lf %lf %lf", &v1, &v2, &r, &d);
        t = r * asin(v1 / v2) / v1;
        if(v2 * t - d <= NUM)
            printf("Wake up to code\n");
        else
            printf("Why give up treatment\n");
    }
}



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值