现在的位置: 首页 > 综合 > 正文

UVA 11646 – Athletics Track(计算几何)

2018年10月12日 ⁄ 综合 ⁄ 共 334字 ⁄ 字号 评论关闭

这是一题推推公式就可以的题目

假设L为X,然后就可以算出半径,然后根据余弦定理可以算出圆弧长度,然后就可以推出X,输出

代码:

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

double a, b;

int main() {
    int cas = 0;
    while (~scanf("%lf : %lf", &a, &b)) {
        double tmp = b * b / a / a;
        double x = acos((1 - tmp) / (1 + tmp)) / 2 * sqrt(1 + tmp) + 1;
        x = 200.0 / x;
        printf("Case %d: %.10f %.10f\n", ++cas, x, x / a * b);
    }
    return 0;
}

抱歉!评论已关闭.