题目

Description

在二维平面上,有一个固定的圆和一个固定的点(保证该点不在圆上),还有一个动点在圆上以角速度w绕圆心一直转。在t时刻,连接该动点与定点成一条直线k,求直线k被圆所截线段的长度(即直线k在圆内部分长度)。
动点初始时刻在圆的三点钟方向(即与x轴正方向平行),并以逆时针方向绕圆转。

Input

先输入一个整数T,表示T(T<50)组数据。
每组数据一行七个实数a,b,r(r>0),x,y,w(w>=0),t(t>=0) 分别表示圆的圆心坐标(a,b),半径r,固定点坐标(x,y),角速度w,要查询的时刻t。
上述所有数据的绝对值小于10000。

Output

输出答案占一行,保留2位小数。

Sample Input

1
1 1 1 3 1 3 0

Sample Output

2.00

Hint

角速度定义:

一个以弧度为单位的圆(一个圆周为2π,即:360度=2π),在单位时间内所走的弧度即为角速度。

题解

纯粹的数学问题。

使用两点式、点到直线距离公式、勾股定理求解即可

要注意的是

double输入用%lf 输出用%f

不然会有奇妙的问题出现

double的读入与输出

代码

/*
By:OhYee
Github:OhYee
HomePage:http://www.oyohyee.com
Email:oyohyee@oyohyee.com
Blog:http://www.cnblogs.com/ohyee/

かしこいかわいい?
エリーチカ!
要写出来Хорошо的代码哦~
*/

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
using namespace std;

//DEBUG MODE
#define debug 0

//循环
#define REP(n) for(int o=0;o<n;o++)

const double PI = 3.1415926;

void Do() {
    double a,b,r,x,y,w,t;
    scanf("%lf%lf%lf%lf%lf%lf%lf",&a,&b,&r,&x,&y,&w,&t);

    double xb = a + r * cos(w*t);
    double yb = b + r * sin(w*t);

    double A = y - yb;
    double B = xb - x;
    double C = x * yb - xb * y;

    double l = abs(A * a + B * b + C) / sqrt(A * A + B * B);

    double ans = 2 * sqrt(r * r - l * l);

    printf("%.2f\n",abs(ans));
}

int main() {
    int T;
    scanf("%d",&T);
    while(T--) 
        Do();
    return 0;
}