p120.ans1
======================
1.000000 0.000000
0.000000 1.000000
1.000000 2.000000
2.000000 1.000000

=================
p120.cpp
======================
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

using Point = complex<long double>;

int n, a, b;
vector<Point> points;

void read() {
    cin >> n >> a >> b;
    points.assign(n + 1, Point());
    long double x, y;
    cin >> x >> y;
    points[a] = Point(x, y);
    cin >> x >> y;
    points[b] = Point(x, y);
}

void solve() {
    // The islands are vertices of a regular N-gon listed clockwise, and we know
    // two of them (indices a, b). The chord between vertices a and b subtends a
    // central angle of 2*pi*(b-a)/n, so the circumradius is dist / 2 /
    // sin(pi*(b-a)/n) and the circle centre lies on the perpendicular bisector
    // of that chord (offset by the half-chord over tan of the half-angle).
    // Once the centre and the angular position phi of vertex a are known, every
    // other vertex i sits at angle phi + 2*pi*(a-i)/n on the circle.

    if(a > b) {
        swap(a, b);
    }

    const long double PI = 3.14159265358979323846L;
    long double dist = abs(points[b] - points[a]);
    long double radius = dist / sin(PI * (b - a) / n) / 2;

    Point mid = (points[a] + points[b]) / 2.0L;
    Point center =
        mid +
        Point(
            (points[b].imag() - points[a].imag()) / tan(PI * (b - a) / n) / 2,
            -(points[b].real() - points[a].real()) / tan(PI * (b - a) / n) / 2
        );

    long double phi = asin((points[a].imag() - center.imag()) / radius);
    if(acos((points[a].real() - center.real()) / radius) > PI / 2) {
        phi = (phi >= 0 ? PI - phi : -PI - phi);
    }

    for(int i = 1; i <= n; i++) {
        if(i != a && i != b) {
            long double delta = phi + 2 * PI * (a - i) / n;
            points[i] =
                center + Point(radius * cos(delta), radius * sin(delta));
        }
    }

    cout << fixed << setprecision(6);
    for(int i = 1; i <= n; i++) {
        cout << points[i].real() << " " << points[i].imag() << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}

=================
p120.in1
======================
4 1 3
1.0000 0.0000
1.0000 2.0000

=================
statement.txt
======================
120. Archipelago

time limit per test: 0.25 sec.
memory limit per test: 4096 KB


Archipelago Ber-Islands consists of N islands that are vertices of equiangular and equilateral N-gon. Islands are clockwise numerated. Coordinates of island N1 are (x1, y1), and island N2 – (x2, y2). Your task is to find coordinates of all N islands.


Input

In the first line of input there are N, N1 and N2 (3£ N£ 150, 1£ N1,N2£N, N1¹N2) separated by spaces. On the next two lines of input there are coordinates of island N1 and N2 (one pair per line) with accuracy 4 digits after decimal point. Each coordinate is more than -2000000 and less than 2000000.


Output

Write N lines with coordinates for every island. Write coordinates in order of island numeration. Write answer with 6 digits after decimal point.


Sample Input

4 1 3
1.0000 0.0000
1.0000 2.0000
Sample Output

1.000000 0.000000
0.000000 1.000000
1.000000 2.000000
2.000000 1.000000
Author	: Michael R. Mirzayanov
Resource	: PhTL #1 Training Contests
Date	: Fall 2001

=================
