P4710 平抛运动

  题目:https://www.luogu.org/problemnew/show/P4710

$$ v_x = v_{x_0} = v sin heta,   v_y = v_{y_0} + gt = gt = v cos heta, 这里 v_y = gt Rightarrow t = frac{v_y}{g} $$

$$ left { egin{aligned} x &= v_x t \ y &= frac{1}{2}gt^2 = frac{1}{2}v_yt end{aligned} ight. $$

  于是,AC代码:

#include <bits/stdc++.h>
int main()
{
	double v, vy, theta;
	double x, y, t;
	
	scanf("%lf %lf", &v, &theta);
	vy = v*cos(theta);
	t = vy/10.0;
	x = v*sin(theta)*t;
	y = (vy*t)/2.0;
	printf("%f %f
", x, y);
	return 0;
}

  

  

原文地址:https://www.cnblogs.com/darkchii/p/9250186.html