| 比赛 | 
    小练习赛:B组 | 
    评测结果 | 
    AAAAA | 
    | 题目名称 | 
    自由落体 | 
    最终得分 | 
    100 | 
    | 用户昵称 | 
    hzoi55223 | 
    运行时间 | 
    0.002 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.31 MiB  | 
    | 提交时间 | 
    2014-10-21 19:20:13 | 
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
 
double h,s,v,l,k,t1,t2;
double x,y;
int n;
int tot=0;
 
void work();
int main()
{
	freopen("freefaller.in","r",stdin);
	freopen("freefaller.out","w",stdout);
	cin>>h>>s>>v>>l>>k>>n;
	work();
	cout<<tot;
	return 0;
}
 
void work()
{
	t1=2*(h-k)/10;
	t2=2*h/10;
	t1=sqrt(t1);
	t2=sqrt(t2);
	x=s-v*t2;
	y=s+l-v*t1;
	if(x>n-1+0.00001)
	{
		return ;
	}
	for(int i=0;i<n;++i)
	{
		if(i>=x-0.00001&&i<=y+0.00001)
		{
			tot++;
		}
	}
}