首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >【周练】 物理题

【周练】 物理题

作者头像
FishWang
发布2025-08-26 19:04:57
发布2025-08-26 19:04:57
6300
代码可运行
举报
运行总次数:0
代码可运行

物理题 Crawling in process... Crawling failed

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Description

Come back school from the 33 rdACM / ICPC Asia ChenDu, everyone is exhausted, in particular the captain Wiskey. As saying that night, Wiskey drink a lot of wine, just as he blurred, fall to sleep. All of a sudden, Wiskey felt a slight discomfort in the chest, and then vomiting, vomitted all over. The next day, Wiskey is extremely sluggish, vomit still on the train. Your task is to calculate the coordinates of vomit. We assume that the quality of vomit is m, and its size can be ignored. As the figure below:

The vomit start from the blue point A, whose speed is V, and its angle with X-axis is a. If the vomit hit the ceiling, then its value of the speed don't changed and if before the collision the angle of the speed with X-axis is b, then after the collision the angle of the speed with X-axis is b , too. Ignore air resistance, acceleration due to gravity g = 9.87m/s 2, calculate and output Q. (you can assume that the vomit will not fall to the higher berth)

Input

Each line will contain three numbers V , m and a (0 <= a < 90)described above. Process to end of file.

Output

For each case, output Q in one line, accurate up to 3 decimal places.

Sample Input

代码语言:javascript
代码运行次数:0
运行
复制
100 100 45 

Sample Output

代码语言:javascript
代码运行次数:0
运行
复制
3.992 

室友和我一致吐槽:好恶心!!!用个小球也好啊,非得弄个呕吐物。就当复习高中物理吧,比较爽的是,高中需要算半天,现在只需要写代码,省事多了!

代码如下:

代码语言:javascript
代码运行次数:0
运行
复制
#include <stdio.h>
#include <math.h>
#define PI 3.1415926
#define g 9.87
int main()
{
	double v,m,a;
	double vx,vy;		//正交分解 
	double h1,h2;
	double t,t1,t2;		//总时间,上升时间,下落时间
	double Q;
	while (~scanf ("%lf%lf%lf",&v,&m,&a))
	{
		h1=0.5;
		h2=3;
		a=a/180*PI;
		vx=v*cos(a);
		vy=v*sin(a);
		if (vy*vy/(2*g)<=h1)
		{
			t1=vy/g;
			h2=h2+(vy*vy/2/g);
			t2=sqrt(2*h2/g);
			t=t1+t2;
			Q=t*vx;
			printf ("%.3lf\n",Q);
		}
		else
		{
			double vv;		//反弹时y轴速度 
			vv=sqrt(vy*vy-2*g*h1);
			h2=3.5;
			t1=(vy-vv)/g;
			t2=(-2*vv+sqrt(4*vv*vv+8*g*h2))/2/g;
			t=t1+t2;
			Q=t*vx;
			printf ("%.3lf\n",Q);
		}
	}
	return 0;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2025-08-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档