UVA - 11646 - Athletics Track (计算几何~)

题目地址:点这里

思路:计算几何入门题,首先,两个圆弧是同一个圆的,所以这个圆是矩形的外接圆,那么矩形中心就是圆心,由长宽算出角度和半径(这时用单位长度表示),再算出一个单位长度的实际长度,从而得出长和宽

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;
} 
时间: 2024-08-04 14:13:47

UVA - 11646 - Athletics Track (计算几何~)的相关文章

UVA 11646 - Athletics Track(计算几何)

这是一题推推公式就可以的题目 假设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&qu

纯几何题 --- UVA - 11646 Athletics Track

这一题题目有点坑,注意这句话: 这代表了其圆心就是矩形的中心! 然后就可以推公式: 可知: x = 200/(a+2atan(b/c)*r); r = sqrt(a*a + b*b); 所以有AC代码如下: #include <iostream> #include <cstdio> #include <cmath> using namespace std; int main() { int k = 0; double a, b; while(scanf("%l

UVA 11178-Morley&#39;s Theorem(计算几何_莫雷定理)

Problem D Morley's Theorem Input: Standard Input Output: Standard Output Morley's theorem states that that the lines trisecting the angles of an arbitrary plane triangle meet at the vertices of an equilateral triangle. For example in the figure below

UVA11646 - Athletics Track

给你一个矩形的长宽比,中间为矩形两端为圆弧的跑道周长为400,求长宽. 我的做法: 反正两边的圆弧可以随便做,那么为了方便起见,就直接用长宽的一半做直角三角形的斜长做圆弧的半径 求出周长的缩小比例 我的代码: #include<iostream> #include<map> #include<string> #include<cstring> #include<cstdio> #include<cstdlib> #include<

UVA 11930 - Rectangles(2-sat + 计算几何)

UVA 11930 - Rectangles 题目链接 题意:给定一些矩形,每个在两条对角线选一条,保证全部不相交,问可不可行(这题有坑啊,矩形不一定平行坐标轴...) 思路:2-sat,主对角线为true,副对角线为false,枚举两个矩形的每条对角线,利用叉积判相交,如果相交就加一条边进去,最后2-sat判定即可 代码: #include <cstdio> #include <cstring> #include <cstdlib> #include <vect

[UVA]11800-Determine the Shape(计算几何)

这道题比较基础,方法也比较多,我的话是使用了向量法进行计算. 任意枚举3个点,看这3个点确定的3个向量和第四个点是否构成一个平行四边形,如果是平行四边形,再进行特殊图形的判断. 14118653 11800 Determine the Shape Accepted C++ 0.102 2014-08-30 13:31:48 #include <iostream> #include <cstdlib> #include <cstdio> #include <stri

UVA 10652 Board Wrapping 计算几何

多边形凸包.... Board Wrapping Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu Submit Status Description Problem B Board Wrapping Input: standard input Output: standard output Time Limit: 2 seconds The small sawmill in Mission, Britis

UVA 11186 - Circum Triangle(计算几何+容斥)

这题用n^2的算法能过,先任意枚举两点,和圆心组成的三角形求面积,这个面积可能会被加(n - 2)次,但是要注意,如果有3点是在同一侧,那么要减去,于是在枚举一遍,每次枚举一个点,然后枚举和这个点度数相差180以内的点,求面积,这个面积要减去2 * (j - i + 1)次 代码: #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespac

UVA 11437 - Triangle Fun(计算几何)

这题只要根据题目,利用向量把点一个个求出来计算面积即可 不过据说有一种证明方法可以证明面积是1/7的原三角形 代码: #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; int t; struct Point { double x, y; Point() {} Point(double x, double y) { th