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

Problem Description
As we all know, Harry Porter learns magic at Hogwarts School. However, learning magical knowledge alone is insufficient to become a great magician. Sometimes, Harry also has to gain knowledge from other certain subjects, such as language, mathematics, English,
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?
 
Input
They are several test cases, you should process to the end of file.

There are two integers V and V0 for
each test case. All the integers are 32-bit signed non-negative integers.
 
Output
For each test case, just output one line that contains an integer indicate the speed of the small ball after the collision.
 
Sample Input
0 10
 
Sample Output
-10
 
Source
 

 官方题解

这是去年一个学妹问我的物理题。我是这样考虑的:题目告诉我们。小球和车发生的是全然弹性碰撞。那么动能是守恒的。而碰撞过程中。动量也守恒。联立动能守恒。动量守恒方程。

然后另一个非常特殊的条件,车的质量远大于小球,那么结合下实际情况,一个质量非常小的物体撞质量非常大的物体,大的物体的速度是不会发生变化的。有了这个条件。就能够求解了。推导步骤例如以下:
用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)的更多相关文章

  1. HDU 5066 Harry And Physical Teacher(物理题)

    HDU 5066 Harry And Physical Teacher 思路:利用物理里面的动量守恒公式.因为保证小车质量远大于小球.所以能够把小车质量当成无穷大带进去,得到答案为2 * v0 - v ...

  2. BestCoder Round #14

    Harry And Physical Teacher Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Ja ...

  3. hdu4932 Miaomiao&#39;s Geometry (BestCoder Round #4 枚举)

    题目链接:pid=4932" style="color:rgb(202,0,0); text-decoration:none">http://acm.hdu.edu ...

  4. (BestCoder Round #64 (div.2))Array

    BestCoder Round #64 (div.2) Array 问题描述 Vicky是个热爱数学的魔法师,拥有复制创造的能力. 一开始他拥有一个数列{1}.每过一天,他将他当天的数列复制一遍,放在 ...

  5. 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 ...

  6. hdu 5063 Operation the Sequence(Bestcoder Round #13)

    Operation the Sequence                                                                     Time Limi ...

  7. 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 + ...

  8. HDU 5805 - NanoApe Loves Sequence (BestCoder Round #86)

    先找相邻差值的最大,第二大,第三大 删去端点会减少一个值, 删去其余点会减少两个值,新增一个值,所以新增和现存的最大的值比较一下取最大即可 #include <iostream> #inc ...

  9. HDU 5069 Harry And Biological Teacher(AC自动机+线段树)

    题意 给定 \(n\) 个字符串,\(m\) 个询问,每次询问 \(a\) 字符串的后缀和 \(b\) 字符串的前缀最多能匹配多长. \(1\leq n,m \leq 10^5\) 思路 多串匹配,考 ...

随机推荐

  1. 部署Win Server 2012十项注意

    博文来自 http://server.zol.com.cn/351/3511746.html Windows Server 2012是微软公司在2012年推出的面向中小企业应用一款全新的服务器操作系统 ...

  2. HDU 4311 Meeting point-1 && HDU 4312 Meeting point-2

    这俩个题  题意::给出N(<1e5)个点求找到一个点作为聚会的地方,使每个点到达这里的距离最小.4311是 曼哈顿距离 4312是 切比雪夫距离: 曼哈顿距离 :大家都知道 对于二维坐标系a( ...

  3. 乐在其中设计模式(C#) - 提供者模式(Provider Pattern)

    原文:乐在其中设计模式(C#) - 提供者模式(Provider Pattern) [索引页][源码下载] 乐在其中设计模式(C#) - 提供者模式(Provider Pattern) 作者:weba ...

  4. java提高篇(八)-----实现多重继承

    多重继承指的是一个类可以同时从多于一个的父类那里继承行为和特征,然而我们知道Java为了保证数据安全,它只允许单继承.有些时候我们会认为如果系统中需要使用多重继承往往都是糟糕的设计,这个时候我们往往需 ...

  5. C++ primer札记10-继承

    包.继承,多态性C++的三个基本概念,在这里,我们重点总结继承的东西 1 类派生列表 类派生列表中指定一个派生类继承基类,来自列表与一个或多个基类如: class B : public A1,prot ...

  6. Base64加密解密原理以及代码实现

    1. Base64使用A--Z,a--z,0--9,+,/ 这64个字符.    2. 编码原理:将3个字节转换成4个字节( (3 X 8) = 24 = (4 X 6) )先读入3个字节,每读一个字 ...

  7. Java的λ表达(lambda)

    λ表达的基本目的 回调Java8的λ表达式 说明了Java8的λ表达式的基本用途:完毕了回调的原意--代码的參数化. 回调:能够简单地说,假设你的方法须要override底层或JDK的某个类的方法,并 ...

  8. HDU 1085-Holding Bin-Laden Captive!(生成功能)

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  9. 创建高性能移动 web 站点【转载】

    如果你的网站3秒钟没有响应,人们就会失去兴趣了.为了满足响应快这个愿望,需要一个不同的方法在手机上进行分析,设计和测试. 这篇文章将会对Johan Johansson在2013年4月提出"  ...

  10. C#使用xpath找到一个节点

    Xpath这是非常强大.但对比是一个更复杂的技术,希望上面去博客园特别想看看一些专业职位.下面是一些简单Xpath的语法和示例,给你参考 <?xml version="1.0" ...