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 ...
随机推荐
- Spring MVC 返回Json IE出现下载
今天在做一个利用IFrame提交进行form提交表单的时候发现返回的json在ie下竟然弹出了下载的提示, 于是就查看了返回的Content-type:appliation/json;charset= ...
- 智能家居DIY-空气质量检测篇-获取空气污染指数
前言 话说楼主终于升级当爸了,宝宝现在5个月了,宝宝出生的时候是冬天,正是魔都空气污染严重的时候,当时就想搞个自动开启空气净化器,由于种种原因一直没有时间搞,最近终于闲下来了这个事情终于提上议程了,现 ...
- 使用weka训练一个分类器
1 训练集数据 1.1 csv格式 5.1,3.5,1.4,0.2,Iris-setosa 4.9,3.0,1.4,0.2,Iris-setosa 4.7,3.2,1.3,0.2,Iris-setos ...
- iOS框架你了解多少?
1.iOS 系统可以分为以下四层,每个框架对应IOS系统里的一层,每层建立在它下面层的上面.应该尽量使用上层的框架来代替下面的框架.更高层次的框架是对底层框架基于对象的抽象.以下列出几个iOS开发的常 ...
- 只需两步删除 node_modules
peng@PENG-PC /E/_My_File_____/home/learn/web_qianduan/mithril-demo/demo2/mithril -demo $ npm install ...
- SAP文件夹的判断与创建
[转自 http://blog.csdn.net/saphome/article/details/6956918] SAP文件夹存在的判断与创建 2010-08-29 20:15 相关函数:WS_QU ...
- SE16传输配置表数据
SE16标准工具传输配置表数据 (上面说了配置表,所以并不是所有的表都能SE16传输.) 了解到: 1.如果是可维护的表,SE16,执行 然后:表条目->传输条目.选择请求: 2.对于不可维护的 ...
- STM32 ~ 串口DMA通道查找
STM32F4XX: /**************************************************************************************** ...
- Shiro:学习笔记(1)——身份验证
Shiro——学习笔记(1) 1.核心概念 1.Shiro不会自己去维护用户.维护权限:这些需要我们自己去设计/提供:然后通过相应的接口注入给Shiro.2.应用代码直接交互的对象是Subject,也 ...
- NVM安装配置
http://www.kancloud.cn/summer/nodejs-install/71975 配置源 http://www.cnblogs.com/kaiye/p/4937191.html 安 ...