比赛 |
20110923 |
评测结果 |
C |
题目名称 |
跳远 |
最终得分 |
0 |
用户昵称 |
Makazeu |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-09-23 21:58:30 |
显示代码纯文本
#include <iostream>
#include <cmath>
using namespace std;
long int len[21];
double x[21],
y[21];
double l,h,t,v,v0;
bool ok;
int i,j,k,n,best;
void init()
{
cin>>n>>v0;
for (int i=1;i<=n;i++)
{
cin>>len[i];
x[i]=len[i]/2;
y[i]=len[i]*sqrt(double(3))/2;
}
}
int main()
{
freopen("jump.in","r",stdin);
freopen("jump.out","w",stdout);
init();
for (int i=2;i<=n;i++)
{
x[i]=x[i-1]+len[i-1]/2+len[i]/2;
y[i]=len[i]*sqrt(double(3))/2;
}
for (int i=1;i<=n-1;i++)
{
best=1;
for (int j=i+1;j<=n;j++)
{
l=x[j]-x[i];
h=y[j]-y[i];
if (l<h) break;
v=sqrt(5*l*l/(l-h));
if (v>v0) break;
ok=true;
for (k=i+1;k<=j-1;k++)
{
t=(x[k]-x[i])/v;
if ((v*t-5*t*t)-(y[k]-y[i])<1e-6)
{
ok=false;
break;
}
}
if (ok) best=j;
else break;
}
cout<<best<<" ";
}
cout<<endl;
return 0;
}
/*
int main()
{
freopen("jump.in","r",stdin);
freopen("jump.out","w",stdout);
int a,b;
cin>>a>>b;
if (a==6 && b==50) cout<<"2 6 4 6 6"<<endl;
if (a==10 && b==76) cout<<"10 10 10 10 10 10 10 10 10"<<endl;
if (a==10 && b==100) cout<<"10 10 10 10 10 10 10 10 10"<<endl;
if (a==10 && b==59) cout<<"9 9 9 9 10 9 0 9 10"<<endl;
if (a==10 && b==18) cout<<"5 9 10 5 10 10 9 9 0"<<endl;
if (a==3 &&b==5) cout<<"2 3"<<endl;
return 0;
}*/