http://acm.hit.edu.cn/hoj/problem/view?id=2105
已知绳子劲度系数为k 原长为l 桥高为s某人体重为w
重力加速度g=9.81
剩下是一个物理问题:
① 原长小于桥高
kΔl>2wgs//劲度系数太大在空中下不来
v=sqrt(2*g*s-((k*(s-l)*(s-l)/w))); //末速度v>10就挂了
② 原长大于等于桥高
看末速度
#include <stdio.h>
#include <math.h>
int main()
{
double k, l, s, w, v;
const double g = 9.81;
while (scanf("%lf %lf %lf %lf", &k, &l, &s, &w) != EOF)
{
if ( (k == 0) && (l == 0) && (s == 0) && (w == 0) )
break;
if (l < s)
{
if (k * (s - l) * (s - l) > 2 * w * g * s)
{
printf("Stuck in the air.\n");
continue;
}
v = sqrt( 2 * g * s - ( (k * (s - l) * (s - l) / w) ) );
if (v > 10)
{
printf("Killed by the impact.\n");
}
else
{
printf("James Bond survives.\n");
}
}
else if (2 * g * s > 100)
{
printf("Killed by the impact.\n");
}
else
printf("James Bond survives.\n");
}
return 0;
}