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\) 思路 多串匹配,考 ...
随机推荐
- DocFX
微软开源全新的文档生成工具DocFX 微软放弃Sandcastle有些年头了,微软最近开源了全新的文档生成工具DocFX,目前支持C#和VB,类似JSDoc或Sphinx,可以从源代码中提取注释生成文 ...
- Windows下Git服务器搭建[转]
Windows下Git服务器搭建 作为对前两天Git服务器搭建的一个整理,我想分别从服务端和客户端两个角度来记录下整个搭建过程,为了达到目标,我们需要哪些操作. (一)服务端软件和账号的安装配置 ...
- web项目启动,运行方法
1.显示器(Listener) web文件加入 <listener> <listener-class>cn.ro.common.InitListener</li ...
- 注意事项: Solr设备 Hello World
试用 Solr-4.10.2 一 shards, 这两款机器 一是垃圾 rm -r example/solr/collection1/data/* 启动一个 node cd example java ...
- SQLServer2008-2012资源及性能监控—CPU使用率监控具体解释
前言: CPU是server中最重要的资源.在数据库server中,CPU的使用情况应该时刻监控以便SQLServer一直处于最佳状态. 本文将会使用可靠性和性能监视器来获取CPU相关的使用统计信息 ...
- [站点部署_01]wordpress建站网页响应速度慢
最近可能非常多人发现站点打开速度变慢.这里分享一下该问题的定位方法. 我在本地部署了一个wordpress站点,近几天突然发现站点訪问速度奇慢,实在不能忍.于是採用例如以下方法攻克了这个问题: 1)使 ...
- 第七个问题(枚举和set)
set添加元素是基于equals和hashCode函数来确定的两个要素是否是同一物体. public final boolean equals(Object other) 当指定对象等于此枚举常量时, ...
- RH133读书 笔记(3) - Lab 3 Configuring the kernel
Lab 3 Configuring the kernel Goal: Develop skills tuning the /proc filesystem. Gain some experience ...
- Cocos2d-x 3.1.1 学习日志16--A星算法(A*搜索算法)学问
A *搜索算法称为A星算法.这是一个在图形平面,路径.求出最低通过成本的算法. 经常使用于游戏中的NPC的移动计算,或线上游戏的BOT的移动计算上. 首先:1.在Map地图中任取2个点,開始点和结束点 ...
- 我的第一次windows规划
#include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; //WinMain功能被分配一 ...