hdu 5066 Harry And Physical Teacher(Bestcoder Round #14)
Harry And Physical Teacher
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 91 Accepted Submission(s): 68
and even algorithm.
Today, Harry's physical teacher set him a difficult problem: if a small ball moving with a speed V0 made
a completely elastic collision with a car moving towards the same direction with a speed V(V<V0),
and the car far outweighs the ball, what was the speed of the small ball after the collision?
This problem was so difficult that Harry hasn't figure out how to solve it. Therefore, he asks you for help. Could you do him this favor?
There are two integers V and V0 for
each test case. All the integers are 32-bit signed non-negative integers.
0 10
-10
官方题解
这是去年一个学妹问我的物理题。我是这样考虑的:题目告诉我们。小球和车发生的是全然弹性碰撞。那么动能是守恒的。而碰撞过程中。动量也守恒。联立动能守恒。动量守恒方程。 然后另一个非常特殊的条件,车的质量远大于小球,那么结合下实际情况,一个质量非常小的物体撞质量非常大的物体,大的物体的速度是不会发生变化的。有了这个条件。就能够求解了。推导步骤例如以下:
用V表示碰撞前车的速度,V′表示碰撞后车的速度;用V0表示碰撞前球的速度,用V′0表示碰撞后球的速度;用M表示车的质量。用m表示球的质量。(M>>m)
{12MV2+12mV20=12MV′2+12mV′20①MV+mV0=MV′+mV′0② ⇒{12M(V+V′)(V−V′)=12m(V0+V′0(V′0−V0))③M(V−V′)=m(V′0−V0)④
由④可将③约成V+V′=V0+V′0
然后将V′视作V,可得V′0=2V−V0
代码:
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std; int main()
{
long long a,b;
while(~scanf("%I64d%I64d",&a,&b))
{
printf("%I64d\n",2*a-b);
}
return 0;
}
版权声明:本文博主原创文章。博客,未经同意不得转载。
hdu 5066 Harry And Physical Teacher(Bestcoder Round #14)的更多相关文章
- HDU 5066 Harry And Physical Teacher(物理题)
HDU 5066 Harry And Physical Teacher 思路:利用物理里面的动量守恒公式.因为保证小车质量远大于小球.所以能够把小车质量当成无穷大带进去,得到答案为2 * v0 - v ...
- BestCoder Round #14
Harry And Physical Teacher Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Ja ...
- hdu4932 Miaomiao's Geometry (BestCoder Round #4 枚举)
题目链接:pid=4932" style="color:rgb(202,0,0); text-decoration:none">http://acm.hdu.edu ...
- (BestCoder Round #64 (div.2))Array
BestCoder Round #64 (div.2) Array 问题描述 Vicky是个热爱数学的魔法师,拥有复制创造的能力. 一开始他拥有一个数列{1}.每过一天,他将他当天的数列复制一遍,放在 ...
- hdu 5640 King's Cake(BestCoder Round #75)
King's Cake Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- hdu 5063 Operation the Sequence(Bestcoder Round #13)
Operation the Sequence Time Limi ...
- HDU 5806 - NanoApe Loves Sequence Ⅱ (BestCoder Round #86)
若 [i, j] 满足, 则 [i, j+1], [i, j+2]...[i,n]均满足 故设当前区间里个数为size, 对于每个 i ,找到刚满足 size == k 的 [i, j], ans + ...
- HDU 5805 - NanoApe Loves Sequence (BestCoder Round #86)
先找相邻差值的最大,第二大,第三大 删去端点会减少一个值, 删去其余点会减少两个值,新增一个值,所以新增和现存的最大的值比较一下取最大即可 #include <iostream> #inc ...
- HDU 5069 Harry And Biological Teacher(AC自动机+线段树)
题意 给定 \(n\) 个字符串,\(m\) 个询问,每次询问 \(a\) 字符串的后缀和 \(b\) 字符串的前缀最多能匹配多长. \(1\leq n,m \leq 10^5\) 思路 多串匹配,考 ...
随机推荐
- 【Python项目】配合爱漫画爬取漫画脚本而设计的GUI漫画阅读器 (一)
博客园的第一个坑,想想都有点小激动 =3= 首先是那个爬虫的地址: [原创]最近写的一个比较hack的小爬虫 选择工具: 以前用过Qt,那么选pyqt4也就是情理之中了. 明确需求: 0.首先,要读取 ...
- 【leetCode百题成就】Gas Station解题报告
题目: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. ...
- 微渠道发展 BAE交通运输平台和java呼声,微信mysql数据库开发实例 --图文开发教程
持续更新 BAE java开展mysql数据库 图文教程 BAE java语言发展mysql源码下载: 目前微信的发展.BAE开展.java开展.mysql教程开发非常,的介绍基于BAE平台.java ...
- Zygote过程【3】——SystemServer诞生
欢迎转载.转载请注明:http://blog.csdn.net/zhgxhuaa 在ZygoteInit的main()方法中做了几件大事.当中一件便是启动Systemserver进程.代码例如以下: ...
- 认识Require
1. 加载require.js文件 <script type="text/javascript" src="js/require.js" data-mai ...
- CloudFoundry 中的GoRouter性能測试
之前一直感觉CloudFoundry的GoRouter的性能不靠谱,或者我们的CloudFoundry 部署架构存在问题,想着进行一些压力測试,可是一直苦于没有压力測试的工具.上一周,部门须要出一个測 ...
- 【C语言探索之旅】 第二部分第三课:数组
内容简介 1.课程大纲 2.第二部分第三课: 数组 3.第二部分第四课预告:字符串 课程大纲 我们的课程分为四大部分,每一个部分结束后都会有练习题,并会公布答案.还会带大家用C语言编写三个游戏. C语 ...
- Android学习路径(七)建立Action Bar
在action bar最今本的形式中,它只在左边展示了activity的标题以及应用的icon. 即使在这样的简单的形式中,它也不过告诉用户如今在应用的哪个activity中,同一时候为你的应用保持一 ...
- Java 启动线程的方式
面试题:JAVA启动线程的方式有哪些? 1.继承Thread [java] view plaincopy public class java_thread extends Thread{ public ...
- Spring Framework 下载链接_现在有空
下载链接:http://repo.spring.io/libs-release-local/org/springframework/spring/ 点击打开链接 包括Spring的各个版本号: 3.2 ...