题目地址:点这里
思路:计算几何入门题,首先,两个圆弧是同一个圆的,所以这个圆是矩形的外接圆,那么矩形中心就是圆心,由长宽算出角度和半径(这时用单位长度表示),再算出一个单位长度的实际长度,从而得出长和宽
AC代码:
#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <cmath> using namespace std; int main() { double a, b, le, wi, tmp; int cas = 1; while(scanf("%lf : %lf", &a, &b) != EOF) { double ang = 2 * atan(b / a); //根据长和宽的比算出角度 double r = sqrt(a * a + b * b) / 2; //算出半径的单位长度 double hu = r * ang; //算出弧的单位长度 double Unit_length = 200.0 / (hu + a); //算出单位长度的实际长度 le = a * Unit_length, wi = b * Unit_length; //求长和宽的实际长度 printf("Case %d: %.10lf %.10lf\n", cas++, le, wi); } return 0; }
UVA - 11646 - Athletics Track (计算几何~)
原文地址:http://blog.csdn.net/u014355480/article/details/43713161