NOJ [1063] Fleabag VS. Mutt

We consider that Fleabag and Mutt are on the same height and they have a distance D. The wind resistance is F (If F < 0, the wind is from Mutt to Fleabag, or it will be from Fleabag to Mutt). Fleabag or Mutt will give their hidden weapon an initial velocity (both horizontal and vertical).

Both on horizontal side and vertical side, we can consider the weapon is on a uniformly accelerated motion on its two directions and G is 9.8.

Here are two formulas:
a = F / m
s = v0t + (1/2)(at^2)
If the weapon hit the area that the distance to another one is less than 2.0, we consider it hit another one.



物理题,没难度,对于水平方向上的匀减速直线运动,看成反向的初速度为0的匀加速直线运动就可以了,时间也很好计算

#include<stdio.h>
#include<math.h>

int main()
{
	char name[20];
	double dist,v,h,f,d,m,s;
	while(~scanf("%s%lf%lf%lf%lf%lf",name,&d,&f,&m,&h,&v))
	{
		if(f>0)
		{
		   if(name[0]=='F')
	          s=h*(2*v/9.8)+(2*f*v*v)/(9.8*9.8);
	       else
	          s=(2*f*v*v)/(9.8*9.8);
		}
		else
		{
		   	if(name[0]=='M')
			 s=h*(2*v/9.8)-(2*f*v*v)/(9.8*9.8);
			 else
			 s=-(2*f*v*v)/(9.8*9.8);
		}
		if(fabs(s-d)<2.0) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值