题意:
给一个长度为L的钢条,加热后长度改变并且弯曲成一个弧,算出之间的距离
要点:
基础思想是二分,但其实里面包含了很多证明
参考博客:点击打开链接
| 15301383 | Seasonal | 1905 | Accepted | 196K | 0MS | C++ | 510B | 2016-03-22 20:56:20 |
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
double l, n, c,L;
double r;
double depart(double left, double right)
{
double h, r, ll;
while (right-left>0.000001)//精确度6位
{
h = (left + right) / 2.0;
r = (4 * h*h + l*l) / (8 * h);
ll = 2 * r*asin(l / (2 * r));
if (ll > L)
right = h;
else
left = h;
}
return h;
}
int main()
{
while (~scanf("%lf%lf%lf", &l, &n, &c))
{
if (l == -1)
break;
L = l*(1 + n*c);
printf("%.3lf\n", depart(0, l / 2.0));
}
return 0;
}

本文介绍了一种使用二分法计算加热后钢条变形距离的方法。通过精确到六位小数的迭代过程,最终求解加热后的钢条长度及弯曲弧度。
&spm=1001.2101.3001.5002&articleId=50958473&d=1&t=3&u=59f3cfd0568846caaf7e2efb2ec6daaa)
441

被折叠的 条评论
为什么被折叠?



