UVA11646 - Athletics Track

给你一个矩形的长宽比,中间为矩形两端为圆弧的跑道周长为400,求长宽。

我的做法:

反正两边的圆弧可以随便做,那么为了方便起见,就直接用长宽的一半做直角三角形的斜长做圆弧的半径

求出周长的缩小比例

我的代码:

#include<iostream>
#include<map>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int i=0;
	double r,k,a,b;
	while(scanf("%lf : %lf",&a,&b)!=EOF)
	{
		r=sqrt(a*a+b*b)/2;
		k=200/(2*r*atan(b/a)+a);
		printf("Case %d: %.5lf %.5lf\n",++i,k*a,k*b);
	}
}

原题:

Time limit: 1.000 seconds

London Olympics is approachingvery shortly – in just 3 years. Three years might not sound as that small atime to say ‘just’, but it is indeed for those who have to organize the competition.There are so many things to do – preparing the venues, building the
Olympicvillage for accommodating athletes and officials, improving the transportationof the entire city as the venues are located all over the city and also therewill be great number of tourists / spectators during the Olympics.

One of the most important tasksis to build the stadium. You are appointed as a programmer to help things outin certain matters – more specifically in designing and building the athleticstracks. After some study, you find out that athletics tracks have a
generalshape of a rectangle with two sliced circles on two ends. Now the turf that isplaced inside this rectangle is prepared elsewhere and comes in differentshapes – different length to width ratios. You know one thing for certain –your track should have
a perimeter of 400 meters. That’s the standard lengthfor athletics tracks. You are supplied with the design parameter – length towidth ratio. You are also told that the sliced circles will be such that theyare part of the same circle. You have to find the
length and width of therectangle.

 

Input

There will be at most 1000 test cases. Each test case will be given in oneline. It will contain ratio of the length and width of the rectangle in theformat – “a : b”. Here, a and b will be integers and both will be between 1 and1000 (inclusive).

Output

For each test case, output a line in the following format –“Case n: L W” where n is the case no (starting from 1) and L and W are lengthand width of the rectangle (in meters) respectively. You can output as manydigits as you want after the decimal point.
Output will be verified by avalidator for 1E-5 precision.

Sample Input                           Output for SampleInput


3 : 2

5 : 4


Case 1: 117.1858168913 78.1238779275

Case 2: 107.2909560477 85.8327648381

时间: 2024-08-01 22:46:54

UVA11646 - Athletics Track的相关文章

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

题目地址:点这里 思路:计算几何入门题,首先,两个圆弧是同一个圆的,所以这个圆是矩形的外接圆,那么矩形中心就是圆心,由长宽算出角度和半径(这时用单位长度表示),再算出一个单位长度的实际长度,从而得出长和宽 AC代码: #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <cmath> using namespace std;

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 11437 Triangle Fun UVA 11800 Determine the Shape 四边形判定 UVA 11646 Athletics Track UVA 11817 Tunnelling the Earth 球面距离 UVA 1473 Dome of Circus UVA 11524 InCircle UVA 11731 Ex-circles 旁切圆 UVA 12300 Smallest Regular Polygon UVA 10566 Crossed Ladders

ng-repeat指令中使用track by子语句解决重复数据遍历的错误

用ng-repeat指令遍历一个javascript数组,当数组中有重复元素的时候,angularjs会报错,这是因为ng-Repeat不允许collection中存在两个相同Id的对象. 对于数字或者字符串等基本数据类型来说,它的id就是它自身的值.因此数组中是不允许存在两个相同的数字的.为了规避这个错误,需要定义自己的track by表达式. // 业务上自己生成唯一的iditem in items track by item.id //或者直接拿循环的索引变量$index来用item in

解密FFmpeg播放track mode控制

上一篇文章(http://my.oschina.net/u/2336532/blog/400790)我们解决了在FFmpeg下如何处理H264和AAC的扩展数据,根据解出的NALU长度恢复了H264的起始码和AAC的ADTS头,这样一般来说播放是没有问题.本篇文章来谈谈如何实现基于FFmpeg的track mode控制,也就是如何用FFmpeg提供的功能来实现基本的seek.快进.快退.好了,废话少了,下面开始基于FFmpeg的track mode之旅. FFmpeg提供了一个seek函数,原型

(十三)通过DOM事件DOMNodeRemoved,看ng-repeat的性能问题以及track by的作用

1.DOMNodeRemoved事件 DOMNodeRemoved事件这里不做过多介绍,有个大概的认识,会使用即可.如下代码给content对象注册了DOMNodeRemoved事件处理函数,当content下有子元素被删除的时候,就会触发DOMNodeRemoved事件. <script> window.onload = function(){ var dom = document.getElementById("content"); dom.addEventListen

IEEE/ACM International Conference on Advances in Social Network Analysis and Mining (ASONAM) 2014 Industry Track Call for Papers

IEEE/ACM International Conference on Advances in Social Network Analysis and Mining (ASONAM) 2014 Industry Track Call for Papers Beijing China August 17-20, 2014Home Page: www.asonam2014.org Full paper/short paper/extended abstract submission deadlin

apache 禁止trace或track防止xss攻击

TRACE和TRACK是用来调试web服务器连接的HTTP方式.支持该方式的服务器存在跨站脚本漏洞,通常在描述各种浏览器缺陷的时候,把"Cross-Site-Tracing"简称为XST.攻击者可以利用此漏洞欺骗合法用户并得到他们的私人信息. 禁用trace可以使用rewrite功能来实现RewriteEngine OnRewriteCondi %{REQUEST_METHOD} ^TRACERewriteRule .* - [F] 或者还可以直接在apache的配置文件中配置相应参数