lightoj 1056

LightOJ - 1056
Time Limit: 500MS Memory Limit: 32768KB 64bit IO Format: %lld & %llu

Submit Status

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

Problem Setter: Sabbir Yousuf Sanny
Special Thanks: Jane Alam Jan (Solution, Dataset)

Submit Status

已知矩形的长宽比和体育场的周长,体育场的弧在一个圆上,求长宽

Code:

/*刷的第一道计算几何*/
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#define pi acos(-1.0)
#define maxn (100000 + 50)
#define mod 1000000007
#define Lowbit(x) (x & (-x))
using namespace std;
typedef long long int LLI;



int main() {
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    int t;
    scanf("%d",&t);
    for(int Case = 1; Case <= t; Case ++) {
        double a,b;
        scanf("%lf : %lf",&a,&b);
        double x = 200.0 / ((pi - 2 * atan(a / b)) * sqrt(a * a + b * b) + a * 2);
        printf("Case %d: %.7lf %.7lf\n",Case,a * x * 2,b * x * 2);
    }
    return 0;
}




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值