hdu 5066 Harry And Physical Teacher(Bestcoder Round #14)
and HDU 14 round Teacher Physical
2023-09-14 09:08:07 时间
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 speedV0 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?
Today, Harry's physical teacher set him a difficult problem: if a small ball moving with a speed
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 integersV and V0 for
each test case. All the integers are 32-bit signed non-negative integers.
There are two 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; }
版权声明:本文博主原创文章。博客,未经同意不得转载。
相关文章
- R语言代做编程辅导Big Data Analytics: Assignment – Hurricane Sandy and Flickr(附答案)
- 【Android】开发Android应用时对于Handler消息传递与缓存问题深入运用and理解
- How to Use the Stdin, Stderr, and Stdout Streams in Bash
- ORA-01304: subordinate process error. Check alert and trace logs ORACLE 报错 故障修复 远程处理
- ORA-27049: unable to seek to and read the last block ORACLE 报错 故障修复 远程处理
- ORA-32315: REFRESH FAST of “string”.”string” unsupported after mixed DML and Direct Load ORACLE 报错 故障修复 远程处理
- MySQL Error number: MY-010465; Symbol: ER_RPL_BINLOG_MASTER_USES_CHECKSUM_AND_SLAVE_CANT; SQLSTATE: HY000 报错 故障修复 远程处理
- ORA-16445: Database has to be mounted and cannot be open ORACLE 报错 故障修复 远程处理
- Leading the Next Level of Applications with Redis and AMQP(redisamqp)
- Mastering Oracle DML: Tips and Tricks for Efficient Data Manipulation.(oracledml)
- Ultimate Guide to Oracle Time Configuration for Efficient and Reliable Performance(oracle时间设置)
- Using Linux C Lock to Ensure Efficient and Secure Resource Access(linuxclock)
- Exploring the Importance and Functions of MySQL Primary Key IDs(mysql主键id)
- Exploring the Power of Linux Tips and Tricks for the t Option(linux-t)
- and的区别Oracle数据库中的OR与AND的差异(oracle中or和)
- Oracle 数据库中使用AND拼接的威力(oracle中and拼接)