HDU5066-Harry And Physical Teacher
2017-06-06 00:09
239 查看
Harry And Physical Teacher
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K(Java/Others)
Total Submission(s): 764 Accepted Submission(s): 408
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
BestCoder Round #14
Recommend
heyang
题意:有辆汽车正在运动,速度为V0,一个球和车同向运动,速度为V(V >V0)。球会撞向汽车,然后弹性碰撞。假设汽车的质量远大于气球的质量,求球反弹后的速度
解题思路:弹性碰撞,所以利用动能定理和动量定理
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <bitset>
#include <set>
#include <vector>
#include <functional>
using namespace std;
#define LL long long
const int INF = 0x3f3f3f3f;
int v,v0;
int main()
{
while(~scanf("%d%d",&v,&v0))
{
printf("%d\n",2*v-v0);
}
return 0;
}
相关文章推荐
- hdu 5066 Harry And Physical Teacher(物理)
- hdu5066——Harry And Physical Teacher(物理)
- HDU 5066 Harry And Physical Teacher
- HDU 5066 Harry And Physical Teacher(物理 动量守恒 动能守恒)——BestCoder Round #14
- Bestcoder Round 14# 1001 Harry And Physical Teacher
- BestCoder Round #14 A题 Harry And Physical Teacher
- 【CUGBACM15级BC第14场 A】Harry And Physical Teacher
- hdoj Harry And Physical Teacher 5066 (数学思想)
- HDU 5066 Harry And Physical Teacher
- HDU 5066 Harry And Physical Teacher(数学)
- HDU 5066 Harry And Physical Teacher(物理题)
- HDU 5066 Harry And Physical Teacher(物理题)
- hdu 5066 Harry And Physical Teacher(Bestcoder Round #14)
- hdu 5066 Harry And Physical Teacher(物理题 弹性碰撞)
- hdu 5066 Harry And Physical Teacher(数学)
- hdu 5066 Harry And Physical Teacher(Bestcoder Round #14)
- HDOJ 5066 Harry And Physical Teacher
- hdu 5068 Harry And Math Teacher 线段树
- HDU 5068 Harry And Math Teacher
- 【AC自动机】 HDOJ 5069 Harry And Biological Teacher