Just a JokeTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)

Total Submission(s): 288    Accepted Submission(s): 111

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

21 1 1 111904 41076 3561 3613

Sample Output

Why give up treatmentWake up to code

一开始以为是阿基米德螺线,后来发现不是,因为阿基米德螺线里面点的径向速度v是恒定的,得到的极坐标方程是ρ = aθ (a =v/w) w是圆盘旋转速度, θ = wt。推导过程如下:

一个圆盘以角速度 w 作转动,有一只蚂蚁在圆盘上沿着经过圆心的直线以速度 v 向外爬行,则小虫的运动轨迹为一条等速螺线,也叫阿基米德螺线(Archimedean spiral)。

      假设在时刻 t=0 时,小虫位于原点,则在时刻 t 时,小虫位于(x(t),y(t)),其中

x(t)=vt*cos(wt), y(t)=vt*sin(wt)

这就是等速螺线的参数方程。

      令圆盘的转角 wt=theta,则得到等速螺线的极坐标方程:

r(theta)=(v/w)*(theta)=a*(theta)

 其中a=v/w。

速螺线的极坐标方程:

然后积分求得螺线长度:

可悲的是,这一题不是阿基米德落线,白白wa了那么多次,这一题正解是:因为角速度和外围点一样,所以速度分解可以求得没点的瞬时速度:

vy = sqrt(V2^2-r^2*V1^2/R^2);  又因为dr/dt = r' = vy

1/sqrt(V2^2-r^2*V1^2/R^2)*dr = dt 对两边分别求积分,三角换元:       r = R*V2/V1*sinx =>t=R/V1*arcsin(V1/V2) 然后用t*V2就是他跑的距离了。这一题我卡精度,但实际上不需要卡也可以AC!

 #include <cstring>

 #include <iostream>

 #include <algorithm>

 #include <cstdio>

 #include <cmath>

 #include <map>

 #include <cstdlib>

 #define M(a,b) memset(a,b,sizeof(a))

 using namespace std;

 int T;

 double V1,V2,R,D;

 const double eps=1e-;

 int sgn(double a){return a < -eps ? - : a < eps ?  : ;}

 int main()

 {

    scanf("%d",&T);

    while(T--)

    {

        scanf("%lf%lf%lf%lf",&V1,&V2,&R,&D);

         double t = R/V1*asin(V1/V2);

         double len = V2*t;

         //cout<<len<<endl;

         if(D-len<) puts("Why give up treatment");

         else puts("Wake up to code");

    }

    return ;

 }

2014 Multi-University Training Contest 9#1009的更多相关文章

  1. 2015 Multi-University Training Contest 1 - 1009 Annoying problem

    Annoying problem Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=5296 Mean: 给你一个有根树和一个节点集合 ...

  2. hdu 6394 Tree (2018 Multi-University Training Contest 7 1009) (树分块+倍增)

    链接: http://acm.hdu.edu.cn/showproblem.php?pid=6394 思路:用dfs序处理下树,在用分块,我们只需要维护当前这个点要跳出这个块需要的步数和他跳出这个块去 ...

  3. HDU 4608 I-number 2013 Multi-University Training Contest 1 1009题

    题目大意:输入一个数x,求一个对应的y,这个y满足以下条件,第一,y>x,第二,y 的各位数之和能被10整除,第三,求满足前两个条件的最小的y. 解题报告:一个模拟题,比赛的时候确没过,感觉这题 ...

  4. 2015 Multi-University Training Contest 5 1009 MZL's Border

    MZL's Border Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=5351 Mean: 给出一个类似斐波那契数列的字符串序列 ...

  5. ACM多校联赛7 2018 Multi-University Training Contest 7 1009 Tree

    [题意概述] 给一棵以1为根的树,树上的每个节点有一个ai值,代表它可以传送到自己的ai倍祖先,如果不存在则传送出这棵树.现在询问某个节点传送出这棵树需要多少步. [题解] 其实是把“弹飞绵羊”那道题 ...

  6. 2019 Multi-University Training Contest 2 - 1009 - 回文自动机

    http://acm.hdu.edu.cn/showproblem.php?pid=6599 有好几种实现方式,首先都是用回文自动机统计好回文串的个数. 记得把每个节点的cnt加到他的fail上,因为 ...

  7. 2019 Multi-University Training Contest 1 - 1009 - String - 贪心

    不知道错在哪里. 是要把atop改成stop!两个弄混了.感谢自造样例. #include<bits/stdc++.h> using namespace std; typedef long ...

  8. 2015 Multi-University Training Contest 3 hdu 5324 Boring Class

    Boring Class Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tota ...

  9. HDU4888 Redraw Beautiful Drawings(2014 Multi-University Training Contest 3)

    Redraw Beautiful Drawings Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Jav ...

随机推荐

  1. 云与备份之(1):VMware虚机备份和恢复

    本系列文章会介绍云与备份之间的关系,包括: (1)VMware 虚机备份和恢复 (2)KVM 虚机备份和恢复 (3)云与备份 (4)OpenStack 与备份 (5)公有云与备份 1. 与备份有关的V ...

  2. 【2016-11-1】【坚持学习】【Day16】【MongoDB】【复制集 分片】

    Mongodb 两种集群方式 复制集 通常是一主一从,一主多从 mongodb的复制至少需要两个节点.其中一个是主节点,负责处理客户端请求,其余的都是从节点,负责复制主节点上的数据. mongodb各 ...

  3. 理解ThreadLocal(之一)

    ThreadLocal是什么 在JDK 1.2的版本中就提供java.lang.ThreadLocal,ThreadLocal为解决多线程程序的并发问题提供了一种新的思路.使用这个工具类可以很简洁地编 ...

  4. redux的中间层 --reactjs学习

    React只负责UI层,也就是我们通常在MVC框架中 所说的View层,所以在使用React开发中 我们得引入Redux 负责Model 一开始学习Redux的中间层 有点 摸不到头, 其实只要你注意 ...

  5. ASP.net 实现禁止用户重复登录

    本文先为大家介绍如何利用缓存Cache方便地实现此功能. Cache与Session这二个状态对像的其中有一个不同之处,Cache是一个全局对象,作用的范围是整个应用程序,所有用户:而Session是 ...

  6. codevs 1015 计算器的改良 2000年NOIP全国联赛普及组

     时间限制: 1 s  空间限制: 128000 KB  题目等级 : 白银 Silver 题目描述 Description NCL是一家专门从事计算器改良与升级的实验室,最近该实验室收到了某公司所委 ...

  7. VS2012的调试插件Image Watch,opencv编程神器

    今天配置 opencv3.0 时无意中看到 Image Watch 这样一个VS2012的调试插件,适用了下,特别好用. 部分链接: Image Watch 的 下载链接 OpenCV关于ImageW ...

  8. 【分享】仿东软OA协同办公服务管理源码

    功能列表: 1.个人办公管理: 内部邮件.消息管理.手机短信.公告通知.新闻管理.投票管理.个人考勤 日程安排:我的安排.下属安排 工作日志:我的日志.日志查询.日志设置 工作汇报:我的汇报.下属汇报 ...

  9. JavaScript事件流原理解析

    一.为什么会有这一篇的文章 国庆前几天由于任务比较重,要赶在国庆前把一个进度的任务开发完成,所以也就有点赶,但是却遇到了一个比较奇怪的Bug,导致了任务比预计的延迟了几个小时,对此深表遗憾,所以利用国 ...

  10. DbUtility v3 背后的故事

    DbUtility v3 背后的故事 时间 DbUtility v3构思了差不多大半年,真正开发到第一个版本发布到NuGet却只花了50天.中途大量时间在完善 Jumony 3,只有三周来开发DbUt ...