light oj 1056
来源:互联网 发布:小额贷款什么软件好 编辑:程序博客网 时间:2024/06/06 09:32
Submit Status uDebug
Description
The next Olympic is approaching very shortly. It's a hard job for the organizers. 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 specifically in designing and building the athletics tracks. After some study, you find 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 find the length and width of the rectangle.
Input
Input starts with an integer T (≤ 1000), denoting the number of test cases.
Each case starts with the 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 case, print the case number, the length and the width. Errors less than 10-6 will be ignored.
Sample Input
2
3 : 2
5 : 4
Sample Output
Case 1: 117.1858168 78.12387792
Case 2: 107.29095604 85.8327648
Source
这题的长和宽均指的的长方形的长和宽
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const double pi = acos(-1.0);
int main()
{
int t, ncase=1;
scanf("%d", &t);
while(t--)
{
double x, y;
scanf("%lf : %lf", &x, &y);
double h=atan(1.0*(x/y));
double r=200/(2*sin(h)+pi-2*h);
double length=2*r*sin(h), width=2*r*cos(h);
printf("Case %d: %.10f %.10f\n",ncase++,length,width);
}
return 0;
}
- light oj 1056
- light oj
- light oj
- Light OJ
- Light OJ
- Light OJ 1000
- Light OJ 1001
- Light OJ 1008
- Light OJ 1022
- Light OJ 1015
- Light OJ 1042
- light oj 1128
- Light OJ 1055 BFS
- Light OJ Beginners Problems
- Light OJ Basic Geometry
- Light OJ Basic Math
- light oj 1124
- Light OJ 1012
- HDU 5810 Balls and Boxes (找公式)
- 进程间传递描述符
- A. Mishka and Game
- poj1679The Unique MST(最小生成树)
- ubuntu下nodejs安装与版本升级
- light oj 1056
- 日期的加减类
- HDOJ 2098 素数表
- leetcode 69 Sqrt(x)
- 学习清单
- (二十)、抽象类
- 数据结构实验之串三:KMP应用
- 硬币游戏
- 【OpenCV】3D场景定位的一些资源