记录编号 |
33917 |
评测结果 |
AAAAAA |
题目名称 |
跳远 |
最终得分 |
100 |
用户昵称 |
Truth.Cirno |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.002 s |
提交时间 |
2011-11-21 22:22:23 |
内存使用 |
0.26 MiB |
显示代码纯文本
#include <cstdio>
#include <cmath>
using namespace std;
double x[11]={0},y[11]={0};
bool check(double v,int l,int r)
{
int i;
double t;
for (i=l+1;i<r;i++)
{
t=(x[i]-x[l])/v;
if (!(v*t-5.0*t*t+0.000001>=y[i]-y[l]))
return(false);
}
return(true);
}
int main(void)
{
freopen("jump.in","r",stdin);
freopen("jump.out","w",stdout);
int i,j,n,v0,temp,sou[11]={0},sum[11]={0};
double v,dx,dy;
scanf("%d %d",&n,&v0);
for (i=1;i<=n;i++)
{
scanf("%d",&sou[i]);
sum[i]=sum[i-1]+sou[i];
x[i]=sum[i-1]+0.5*sou[i];
y[i]=sqrt(0.75*sou[i]*sou[i]);
}
for (i=1;i<=n-1;i++)
{
temp=0;
for (j=i+1;j<=n;j++)
{
dx=x[j]-x[i];
dy=y[j]-y[i];
v=sqrt(5.0*dx*dx/(dx-dy));
if (v<=v0+0.000001&&check(v,i,j))
temp=j;
else
break;
}
printf("%d ",temp);
}
printf("\n");
fclose(stdin);
fclose(stdout);
return(0);
}