比赛 |
20110923 |
评测结果 |
AAAAAA |
题目名称 |
跳远 |
最终得分 |
100 |
用户昵称 |
belong.zmx |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-09-23 20:14:26 |
显示代码纯文本
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;
int n,v0,a[11],i,j,ans;
double g,x,t,fast,v_n,f_x[11],f_y[11];
int main()
{
freopen("jump.in","r",stdin);
freopen("jump.out","w",stdout);
scanf("%d%d\n",&n,&v0);
for (i=1;i<=n;i++)
scanf("%d",&a[i]);
for (i=1;i<=n;i++)
{
f_x[i]=f_x[i-1]+double(a[i]+a[i-1])/2;
f_y[i]=double(a[i])*1.7320508075689/2;
}
g=10;
for (i=1;i<=n-1;i++)
{
ans=0;
fast=0;
for (j=i+1;j<=n;j++)
{
if ((f_x[j]-f_y[j])-(f_x[i]-f_y[i])<0) break;
t=sqrt(2*((f_x[j]-f_y[j])-(f_x[i]-f_y[i]))/g);
v_n=(f_x[j]-f_x[i])/t;
if (v_n>fast && v_n<=v0)
{
fast=v_n;
ans=j;
}
else break;
}
if (i!=n-1) printf("%d ",ans);
}
printf("%d\n",ans);
return 0;
}