Preparing for Exams(割线定理)

https://cn.vjudge.net/contest/251958#problem/G

割线定理(Secant Theorem)指的是从外一点引圆的两条割线,这一点到每条割线与圆交点的距离的积相等。

文字表达:从圆外一点引圆的两条割线,这一点到每条割线与圆交点的距离的积相等。

数学语言:从圆外一点L引两条割线与圆分别交于A.B.C.D 则有 LA·LB=LC·LD=LT²。

几何语言:∵割线LDC和LBA交于圆O于ABCD点

∴LA·LB=LC·LD=LT²

如图所示。(LT为切线

这个题其实并不一定需要用到割线定理,因为圆的内切四边形的对角和为180,所以角oda = 角cbo,所以三角形oda相似于三角形obc。所以写出各边之比即可求解。。。

Ran Mouri and Sonoko Suzuki are preparing for the final exams. They decided to study mathematics as it is the hardest subject for them. While they are solving mathematical problems, they faced troubles with some questions, including the following question:

You are given a drawing for a sensor and some measurements about it. You have to find the rest of measurements. Sensor's design is as follow:

The data you have is the length of , the length of , the area of  oda, and the area of  obc. Your task is to calculate x and y, where x is the length of  and y is the length of .

Can you help Ran and Sonoko Suzuki by solving this question?

Input

The first line contains an integer T (1 ≤ T ≤ 2 × 105), in which T is the number of test cases.

Then T lines follow, each line contains four integers klm, and n (1 ≤ k, l, m, n ≤ 1012), in which k is the length of l is the length of m is the area of  oda, and n is the area of  obc.

Output

For each test case, print a single line containing two numbers x and y, where x is the length of  and y is the length of . Your output will be considered correct if the absolute or relative error of every number in your output does not exceed 10 - 6.

Example

Input

1
18 16 72 288

Output

20 14
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
    int T;
    double k, l, m, n;
    double x, y;
    scanf("%d", &T);
    while(T--)
    {
        scanf("%lf%lf%lf%lf", &k, &l, &m, &n);
        x = k*1.0*(sqrt(n/m));//函数原型为double sqrt(double);
        x = x - l;
        y = l*1.0*(sqrt(n/m));
        y = y - k;
        printf("%lf %lf\n", x, y);
    }
    return 0;
}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值