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. effective c++ prefer const,enum, inline to #defines

    学习心得 对于纯常量,最好以const对象或者enums替换#define #define FIRST 3 //not good enum { first=1, second=2 } ; int nu ...

  2. 逆向wireshark学习SSL协议算法(转)

    小贴士:SSL协议的定义 SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为网络通信提供安全及数据完整 ...

  3. Linux下一个OTL 采用long long类型数据库支持BIGINT

    码如下面: #define OTL_BIGINT long long #define OTL_STR_TO_BIGINT(str,n) \ { \ n=atoll(str); \ } #define ...

  4. Directx11学习笔记【十四】 使用最新的Effect框架和SDK

    由于之前一直在看directx11龙书学习,因此sdk一直用的Microsoft DirectX SDK (June 2010) 版本,最近在stackoverflow上问dx11相关问题时,一直被大 ...

  5. WIZnet通过启动在线培训活动:计算机网络TCP/IP协议而事实上,现在的方法

    为了给大家营造更好的学习环境.WIZnet特此举办第一期培训活动,由WIZnet一线project师为你分享最最前沿和有用的网络技术知识,帮你解答开发过程中的疑问.欢迎前来交流.名额有限(20名满), ...

  6. 七牛对用户使用webp图片格式的使用建议

    Qiniu 七牛问题解答 Chrome浏览器是可打开WebP格式的.可是并非全部的浏览器都支持webp格式,比如360.ie等浏览器是不支持的. WebP格式,谷歌(google)开发的一种旨在加快图 ...

  7. SpringMVC Ajax返回的请求json 的方式来解决在中国字符串乱码问题

    1.org.springframework.http.converter.StringHttpMessageConverter类是类处理请求或相应的字符串.和默认字符集ISO-8859-1,所以当返回 ...

  8. 大约cocos2d-X 3.x使用引擎版本自带的物理引擎Physics

    今天打算用BOX2D物理引擎, 我想我以前听说过一些时间cocos2d-X在3.0版本封装自己的物理引擎Physics, 听名字很霸气量, 这的确是一个比BOX2D非常多( 毕竟是基于BOX2D封装的 ...

  9. UVA 847 - A Multiplication Game(游戏)

    UVA 847 - A Multiplication Game 题目链接 题意:一个数一開始是1,每次轮流乘2-9,谁先大于n谁就赢,问谁胜 思路:博弈,找出必胜态.2-9为stan,10-18为ol ...

  10. LINQ之路系列文章导读

    本系列文章将会分为3篇来进行阐述,如下: LINQ之路(1):LINQ基础 LINQ之路(2):LINQ to SQL本质 LINQ之路(3):LINQ扩展