技巧题

 非常弹得球

物理知识加处理技巧

#include <iostream>
#include <cmath>

using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {

	double vh,E,m,t,p,g;
	g=9.8;
	cin >>m>>p;
	p=p/100;
	E=1000;
	m=m/100;
	//v=pow(2*E/m,0.5);
	double sum=0;
	while(pow(E/m,0.5)>1e-5)
	{
		//t=pow(E/(m*g*g),0.5);
		//vh=pow(E/m,0.5);
	    sum+=(E/(m*g))*2; //有上边两个是式子推出
	    E=E-(E*p);        //从科学的角度E事永远不会等于0的,所以在判断结束的时候只要判断速度小于了1e-5就可以;

	}

	printf("%.3f\n",sum);

	return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41199502/article/details/88617799