11646 - Athletics Track
Time limit: 1.000 seconds
London Olympics is approaching very shortly | in just 3 years. Three years might not sound as that
small a time 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 Olympic village for accommodating athletes
and officials, improving the transportation of the entire city as the venues are located all over the city
and also there will be great number of tourists / spectators during the Olympics.
One of the most important tasks is to build the stadium. You are appointed as a programmer to
help things out in certain matters | more speci cally in designing and building the athletics tracks.
After some study, you nd out that athletics tracks have a general shape of a rectangle with two sliced
circles on two ends. Now the turf that is placed inside this rectangle is prepared elsewhere and comes in
different shapes | different length to width ratios. You know one thing for certain | your track should
have a perimeter of 400 meters. That's the standard length for athletics tracks. You are supplied with
the design parameter | length to width ratio. You are also told that the sliced circles will be such
that they are part of the same circle. You have to nd the length and width of the rectangle.
Input
There will be at most 1000 test cases. Each test case will be given in one line. It will contain ratio of
the length and width of the rectangle in the format `a : b'. Here, a and b will be integers and both
will be between 1 and 1000 (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 length and width of the rectangle (in meters) respectively. You can
output as many digits as you want after the decimal point. Output will be veri ed by a validator for
1E-5 precision.
Sample Input
3 : 2
5 : 4
Sample Output
Case 1: 117.1858168913 78.1238779275
Case 2: 107.2909560477 85.8327648381
这个问题就是让设计一个跑道
跑道是两段直道和两段圆弧道构成的
这里注意 题目中的意思 并不是我们平时见到的跑道
两个半圆弧
而说的是这两个弧共圆
因此 就是一个数学题
#include <iostream>
#include <cstdio>
#include <cmath> //需要用到部分函数
using namespace std;
const double PI=acos(-1.0); //π的大小
int main()
{
double k;
int w,l;
int ca=1;
while(scanf("%d : %d",&l,&w)!=EOF)
{
double d=sqrt(l*l+w*w);
double lc=asin(w/d)/(2*PI)*4*d*PI;
double k=400.0/(lc+2*l);
printf("Case %d: %.7lf %.7lf\n",ca++,k*l,k*w);
}
return 0;
}