ACM学习历程—HDU4969 Just a Joke(物理题)
Just a Joke
Description
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
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
catch up with the girl; otherwise output "Why give up treatment" in a
line.
Sample Input
1 1 1 1
11904 41076 3561 3613
Sample Output
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(物理题)的更多相关文章
- 完成了C++作业,本博客现在开始全面记录acm学习历程,真正的acm之路,现在开始
以下以目前遇到题目开始记录,按发布时间排序 ACM之递推递归 ACM之数学题 拓扑排序 ACM之最短路径做题笔记与记录 STL学习笔记不(定期更新) 八皇后问题解题报告
- ACM学习历程—HDU 5512 Pagodas(数学)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5512 学习菊苣的博客,只粘链接,不粘题目描述了. 题目大意就是给了初始的集合{a, b},然后取集合里 ...
- ACM学习历程—HDU5521 Meeting(图论)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5521 学习菊苣的博客,只粘链接,不粘题目描述了. 题目大意就是一个人从1开始走,一个人从n开始走.让最 ...
- ACM学习历程—HDU2476 String painter(动态规划)
http://acm.hdu.edu.cn/showproblem.php?pid=2476 题目大意是给定一个起始串和一个目标串,然后每次可以将某一段区间染成一种字符,问从起始串到目标串最少需要染多 ...
- ACM学习历程—HDU5700 区间交(树状数组 && 前缀和 && 排序)
http://acm.hdu.edu.cn/showproblem.php?pid=5700 这是这次百度之星初赛2B的第五题.省赛回来看了一下,有这样一个思路:对于所有的区间排序,按左值排序. 然后 ...
- ACM学习历程—HDU5701 中位数计数(中位数 && 计数排序)
http://acm.hdu.edu.cn/showproblem.php?pid=5701 这是这次百度之星初赛2B的第六题.之前白山云做过类似的题,省赛完回来,我看了一下大概就有这样的思路:首先枚 ...
- ACM学习历程—HDU5696 区间的价值(分治 && RMQ && 线段树 && 动态规划)
http://acm.hdu.edu.cn/showproblem.php?pid=5696 这是这次百度之星初赛2B的第一题,但是由于正好打省赛,于是便错过了.加上2A的时候差了一题,当时有思路,但 ...
- ACM学习历程—HDU5668 Circle(数论)
http://acm.hdu.edu.cn/showproblem.php?pid=5668 这题的话,假设每次报x个,那么可以模拟一遍, 假设第i个出局的是a[i],那么从第i-1个出局的人后,重新 ...
- ACM学习历程—HDU5667 Sequence(数论 && 矩阵乘法 && 快速幂)
http://acm.hdu.edu.cn/showproblem.php?pid=5667 这题的关键是处理指数,因为最后结果是a^t这种的,主要是如何计算t. 发现t是一个递推式,t(n) = c ...
随机推荐
- json:js和jquery中轻量级数据交换格式
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.它基于ECMAScript的一个子集. JSON采用完全独立于语言的文本格式,但是也使用了类似于C语言家族 ...
- 【BZOJ4184】shallot 线段树+vector+线性基
[BZOJ4184]shallot Description 小苗去市场上买了一捆小葱苗,她突然一时兴起,于是她在每颗小葱苗上写上一个数字,然后把小葱叫过来玩游戏. 每个时刻她会给小葱一颗小葱苗或者是从 ...
- Collective Mindsets (easy)(逻辑题)
Collective Mindsets (easy) Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d &am ...
- 自动更新GeoIP数据库
#!/bin/bash if [ ! -d /usr/local/share/GeoIP ];then mkdir /usr/local/share/GeoIP fi if [ ! -d /usr/l ...
- 矩阵乘法 NOI2012的一道题
今天,kzj大佬教了我矩阵加速. 让我以这篇随笔表示感谢吧! 这是我刷的一道题:NOI2012 随机数据生成器. 就是普通的矩阵加速,只是要注意的是: 直接用乘法会爆long long,可以参考一下 ...
- ALV行 列颜色设置
ALV的颜色设置分为3种:行.列.单元格. 1.列颜色的设置 在 slis_t_fieldcat_alv-emphasize 中,写入需要的颜色代码. Eg: DATA: fc TYP ...
- 2018年长沙理工大学第十三届程序设计竞赛 E 小木乃伊到我家 【最短路】
时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 AA的欧尼酱qwb是个考古学家,有一天qwb发 ...
- iOS 尝试用 block 闭包 去代替delegate 实现方法
通常都是这样创建alert 再加一个代理 // 创建一个UIAlertView并显示出来 UIAlertView *alertview = [[UIAlertView alloc] initWithT ...
- python 3 json 序列化
python 3 json 序列化 我们学习过用eval内置方法可以将一个字符串转成python对象,不过,eval方法是有局限性的,对于普通的数据类型,json.loads和eval都能用,但遇到特 ...
- sqoop job 增量导入
使用sqoop job做增量导入 在执行导入模式为 incremental 的sqoop job 时,sqoop会获取上次导入操作的 –check-column的value值,也就是说使用sqoop ...