1001：

# Harry And Physical Teacher

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 88    Accepted Submission(s): 66

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  made a completely elastic collision with a car moving towards the same direction with a speed , 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  and  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

m1*v1^2+m2*v2^2=m1*v1'^2+m*v2'^2;

当m2远远大于m1时，可以得出v1'=2*v2-v1;

#include <iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a
#define N 1010
using namespace std;
int main()
{
int a,b;
while(~scanf("%d%d",&a,&b))
{
cout<<(2*a-b)<<endl;
}
return 0;
}

1002、1003、1004未做出（以后慢慢补上）；详见题解：（摘自：http://bestcoder.hdu.edu.cn/

1001 Harry And Physical Teacher

①②

③④

1002 Harry And Dig Machine

1003 Harry And Math Teacher

1004 Harry And Biological Teacher