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 ...
随机推荐
- iOS Base64加密
1.Base64编码说明 Base64编码要求把3个8位字节(3*8=24)转化为4个6位的字节(4*6=24),之后在6位的前面补两个0,形成8位一个字节的形式. 如果剩下的字符不足3个字节,则用0 ...
- php自定义函数: amr转mp3格式
<?php function amr2mp3($file){ if (file_exists($file . '.mp3') == true) { return; } else { $param ...
- Linux中各种压缩文件
.gz格式 压缩: gzip 文件名 解压: gzip -d 欲解压文件名 gunzip 欲解压文件名 说明: 1.只能压缩文件,不能压缩目录 2.压缩和解压的时候不保留原文件 .bz2格式 压缩: ...
- Jquery禁用所有checkbox
$("input[type=checkbox]").each(function(){ $(this).attr("disabled",false);});
- ggplot2绘图系统
ggplot2包实现了一个在R中基于全面一致的语法创建图形时的系统 .在ggplot2中,图是采用串联起来(+)号函数创建的.详细内容参见<ggplot2:数据分析与图形艺术>,这里只简要 ...
- cloudera impala编译 安装 配置 启动
无论是采用GDB调试impala或者尝试修改impala源码,前提都是需要本地环境编译impala,这篇文章详细的分享一下impala编译方法以及编译过程遇到的棘手的问题: 前言: impala官方的 ...
- 正则表达式备忘(基于JavaScript)
基于JS学习的正则表达式 备忘 e.g.匹配以0开头的三位或四位区号,以-分格的7或8位电话号码var reg1 = /^0\d{2,3}\-\d{7,8}$/;或var reg1 = new Reg ...
- [原创]java WEB学习笔记19:初识MVC 设计模式:查询,删除 练习(理解思想),小结 ,问题
本博客为原创:综合 尚硅谷(http://www.atguigu.com)的系统教程(深表感谢)和 网络上的现有资源(博客,文档,图书等),资源的出处我会标明 本博客的目的:①总结自己的学习过程,相当 ...
- python 3 mysql 单表查询
python 3 mysql 单表查询 1.准备表 company.employee 员工id id int 姓名 emp_name varchar 性别 sex enum 年龄 age int 入职 ...
- <轻量算法>根据核密度估计检测波峰算法 ---基于有限状态自动机和递归实现
原创博客,转载请联系博主! 希望我思考问题的思路,也可以给大家一些启发或者反思! 问题背景: 现在我们的手上有一组没有明确规律,但是分布有明显聚簇现象的样本点,如下图所示: 图中数据集是显然是个3维的 ...