[Offer收割]编程练习赛14 register

Ended

Participants:574

Verdict:Time Limit Exceeded
Score:70 / 100
Submitted:2017-04-16 14:28:46

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 2000 + 10;
const double eps = 1e-8;
struct Point
{
    double x, y;
    Point() {}
    Point(double tx, double ty)
    {
        x = tx;
        y = ty;
    }
};
double dist(Point p1,Point p2)
{
    return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
Point get_circle(Point p1, Point p2, double r)
{
    Point mid = Point((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);
    double angle = atan2(p1.x - p2.x, p2.y - p1.y);
    double d = sqrt(r * r - pow(dist(p1, mid), 2));
    return Point(mid.x + d * cos(angle), mid.y + d * sin(angle));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX