您的位置:首页 > 其它

【CUGBACM15级BC第14场 A】Harry And Physical Teacher

2017-08-05 21:12 429 查看

Harry And Physical Teacher

[align=center]Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 861    Accepted Submission(s): 443
[/align]

[align=left]Problem Description[/align]

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 speedV(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?
 

[align=left]Input[/align]

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.
 

[align=left]Output[/align]

For each test case, just output one line that contains an integer indicate the speed of the small ball after the collision.
 

[align=left]Sample Input[/align]

0 10

 

[align=left]Sample Output[/align]

-10

 

高中物理不解释
/* ***********************************************
┆  ┏┓   ┏┓ ┆
┆┏┛┻━━━┛┻┓ ┆
┆┃       ┃ ┆
┆┃   ━   ┃ ┆
┆┃ ┳┛ ┗┳ ┃ ┆
┆┃       ┃ ┆
┆┃   ┻   ┃ ┆
┆┗━┓ 马 ┏━┛ ┆
┆  ┃ 勒 ┃  ┆      
┆  ┃ 戈 ┗━━━┓ ┆
┆  ┃ 壁     ┣┓┆
┆  ┃ 的草泥马  ┏┛┆
┆  ┗┓┓┏━┳┓┏┛ ┆
┆   ┃┫┫ ┃┫┫ ┆
┆   ┗┻┛ ┗┻┛ ┆
************************************************ */
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <bitset>
#include <string>
#include <vector>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <functional>
#define PI acos(-1)
#define eps 1e-8
#define inf 0x3f3f3f3f
#define debug(x) cout<<"---"<<x<<"---"<<endl
typedef long long ll;
using namespace std;

ll  v1 , v2;
int main ( )
{
while (~scanf("%I64d%I64d", &v1, &v2))
{
printf ( "%I64d\n" , 2 * v1 - v2 );
}
}
/************************************************
┆  ┏┓   ┏┓ ┆
┆┏┛┻━━━┛┻┓ ┆
┆┃       ┃ ┆
┆┃   ━   ┃ ┆
┆┃ ┳┛ ┗┳ ┃ ┆
┆┃       ┃ ┆
┆┃   ┻   ┃ ┆
┆┗━┓    ┏━┛ ┆
┆  ┃    ┃  ┆      
┆  ┃    ┗━━━┓ ┆
┆  ┃  AC代马   ┣┓┆
┆  ┃           ┏┛┆
┆  ┗┓┓┏━┳┓┏┛ ┆
┆   ┃┫┫ ┃┫┫ ┆
┆   ┗┻┛ ┗┻┛ ┆
************************************************ */
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  acm hdu