比赛 |
20110923 |
评测结果 |
AAAAAA |
题目名称 |
跳远 |
最终得分 |
100 |
用户昵称 |
苏轼 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-09-23 20:14:00 |
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int main ()
{
freopen("jump.in", "r", stdin);
freopen("jump.out", "w", stdout);
int n, v0;
scanf("%d%d", &n, &v0);
struct {
long double x, y;
} tri[n];
for (int i=0, p=0; i<n; i++)
{
int l;
scanf("%d", &l);
tri[i].x = p + l/2.0;
tri[i].y = sqrtl(3)/2.0*l;
p += l;
}
for (int i=0; i<n-1; i++)
{
long double lastv = 0.0;
int maxa = -1;
for (int j=i+1; j<n; j++)
{
long double dx = tri[j].x-tri[i].x,
dy = tri[j].y-tri[i].y;
if (dx < dy)
break;
long double t = \
sqrtl((dx-(tri[j].y-tri[i].y))/5.0);
long double v = dx/t;
if (v > v0)
break;
else if (v > lastv)
{
maxa = j;
lastv = v;
}
else
break;
}
printf("%d ", maxa+1);
}
putchar('\n');
return 0;
}