UVA 11646 - Athletics Track(計算幾何)
來源:程序員人生 發布時間:2015-03-11 08:32:24 閱讀次數:3346次
這是1題推推公式就能夠的題目
假定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
", ++cas, x, x / a * b);
}
return 0;
}
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈