Just a Joke

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

这道题目是一道高中物理竞赛题,结论是运动轨迹是一个圆弧。如图:
 

其中轨迹圆相切于起始直线,也就是说轨迹圆的圆心在y轴上。

接下来证明:
采用物理中的微元法:
假设在某位置,经过dt时间,dt非常小,接近于0

位置变化如图。
由于dt很小,所以a角度接近于0。于是包含a角的直角三角形近似接近于一块扇形。于是扇形弧长为ra。然后由dr,ra,v2dt构成的直角三角形得到如下式子:

然后两边同除以dt得:

即:

其中w为角速度,v为径向速度。(当然,用速度分解能更快得出这个结论)
由v1可得角速度
w=v1/R
于是就是一个求解r的微分方程了。(v=dr/dt)
但是发现这个微分方程求解的时候如果换元,换元的时候是令

化简出来如果k=w,那么是个恒等式。

说明是恒成立的。

然后由图中关系便可得轨迹。

不过这个题目不需要求轨迹方程,不过如果知道结论当然更好。这样以后推导中间的几何关系便可得出判断的式子
最后得出的结论是如果arcsin(v1v2)<=(v1/v2)*(D/R)那么能追上。

 
代码:
 #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define inf 0x3fffffff
#define eps 1e-10 using namespace std; long long v1, v2, r, d;
double x, y; int main()
{
//freopen ("test.txt", "r", stdin);
int T;
scanf ("%d", &T);
for (int times = ; times < T; ++times)
{
scanf ("%I64d%I64d%I64d%I64d", &v1, &v2, &r, &d);
x = (v1+0.0)/v2;
y = (d+0.0)/r;
y = x * y;
x = asin(x);
if (x > y)
printf ("Why give up treatment\n");
else
printf ("Wake up to code\n");
}
return ;
}

ACM学习历程—HDU4969 Just a Joke(物理题)的更多相关文章

  1. 完成了C++作业,本博客现在开始全面记录acm学习历程,真正的acm之路,现在开始

    以下以目前遇到题目开始记录,按发布时间排序 ACM之递推递归 ACM之数学题 拓扑排序 ACM之最短路径做题笔记与记录 STL学习笔记不(定期更新) 八皇后问题解题报告

  2. ACM学习历程—HDU 5512 Pagodas(数学)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5512 学习菊苣的博客,只粘链接,不粘题目描述了. 题目大意就是给了初始的集合{a, b},然后取集合里 ...

  3. ACM学习历程—HDU5521 Meeting(图论)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5521 学习菊苣的博客,只粘链接,不粘题目描述了. 题目大意就是一个人从1开始走,一个人从n开始走.让最 ...

  4. ACM学习历程—HDU2476 String painter(动态规划)

    http://acm.hdu.edu.cn/showproblem.php?pid=2476 题目大意是给定一个起始串和一个目标串,然后每次可以将某一段区间染成一种字符,问从起始串到目标串最少需要染多 ...

  5. ACM学习历程—HDU5700 区间交(树状数组 && 前缀和 && 排序)

    http://acm.hdu.edu.cn/showproblem.php?pid=5700 这是这次百度之星初赛2B的第五题.省赛回来看了一下,有这样一个思路:对于所有的区间排序,按左值排序. 然后 ...

  6. ACM学习历程—HDU5701 中位数计数(中位数 && 计数排序)

    http://acm.hdu.edu.cn/showproblem.php?pid=5701 这是这次百度之星初赛2B的第六题.之前白山云做过类似的题,省赛完回来,我看了一下大概就有这样的思路:首先枚 ...

  7. ACM学习历程—HDU5696 区间的价值(分治 && RMQ && 线段树 && 动态规划)

    http://acm.hdu.edu.cn/showproblem.php?pid=5696 这是这次百度之星初赛2B的第一题,但是由于正好打省赛,于是便错过了.加上2A的时候差了一题,当时有思路,但 ...

  8. ACM学习历程—HDU5668 Circle(数论)

    http://acm.hdu.edu.cn/showproblem.php?pid=5668 这题的话,假设每次报x个,那么可以模拟一遍, 假设第i个出局的是a[i],那么从第i-1个出局的人后,重新 ...

  9. ACM学习历程—HDU5667 Sequence(数论 && 矩阵乘法 && 快速幂)

    http://acm.hdu.edu.cn/showproblem.php?pid=5667 这题的关键是处理指数,因为最后结果是a^t这种的,主要是如何计算t. 发现t是一个递推式,t(n) = c ...

随机推荐

  1. [Sdoi2014]数数[数位dp+AC自动机]

    3530: [Sdoi2014]数数 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 834  Solved: 434[Submit][Status][ ...

  2. 【CodeM初赛A轮】D 分解质因数+暴力

    题目描述树链是指树里的一条路径.美团外卖的形象代言人袋鼠先生最近在研究一个特殊的最长树链问题.现在树中的每个点都有一个正整数值,他想在树中找出最长的树链,使得这条树链上所有对应点的值的最大公约数大于1 ...

  3. OpenCV玩耍(一)批量resize一个文件夹里的所有图像

    鉴于用caffe做实验的时候,里面牵扯到一个问题是必须将训练集和测试集都转成256*256的图像,而官网给出的代码又不会用,所以我用opencv转了.其实opencv只转一幅图会很简单,关键在于“批量 ...

  4. elasticsearch从入门到出门-03-多种搜索

    1.query string search 2.query DSL 3.query filter 4.full-text search 5.phrase search 6.highlight sear ...

  5. importlib 模块导入

    #1.动态导入模块 script_name = scripts.utils module = importlib.import_module(script_name) # 动态导入相应模块 #2.模块 ...

  6. Linux踢出已登录用户

    1.使用w命令可以查看当前登录系统的所有用户 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty1 - 08:05 4:29 0.09s 0.09s - ...

  7. pg 和sql server 分别如何新建二进制数据库字段以及插入二进制数据的sql语句

    PG create table demo ( id int, name bytea ); Insert into demo (id,name)values(256,pg_read_binary_fil ...

  8. [转载]Java集合容器简介

    Java集合容器主要有以下几类: 1,内置容器:数组 2,list容器:Vetor,Stack,ArrayList,LinkedList, CopyOnWriteArrayList(1.5),Attr ...

  9. Write 语句

    ABAP Write 语句 转载▼http://blog.sina.com.cn/s/blog_5ccd375b0100ghhi.html   1.Write 叙述 ABAP/4 用来在屏幕上输出数据 ...

  10. linux 7- - watch,free,mpstat,vmstat,iostat,pidstat,df,du

    十八.  和系统运行状况相关的Shell命令:     1.  Linux的实时监测命令(watch):     watch 是一个非常实用的命令,可以帮你实时监测一个命令的运行结果,省得一遍又一遍的 ...