首页 > 代码库 > HDU 5066 Harry And Physical Teacher(物理题)

HDU 5066 Harry And Physical Teacher(物理题)

HDU 5066 Harry And Physical Teacher

思路:利用物理里面的动量守恒公式,由于保证小车质量远大于小球,所以可以把小车质量当成无穷大带进去,得到答案为2 * v0 - v;

代码:

#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

typedef long long ll;
int v, v0;

int main() {
	while (~scanf("%d%d", &v, &v0)) {
		printf("%d\n", -v0 + 2 * v);
	}
	return 0;
}


HDU 5066 Harry And Physical Teacher(物理题)