p120.cpp
======================
#include <bits/stdc++.h>
using namespace std;

using Point = complex<long double>;

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

    int n, a, b;
    cin >> n >> a >> b;

    vector<Point> points(n + 1);
    long double x, y;
    cin >> x >> y;
    points[a] = Point(x, y);
    cin >> x >> y;
    points[b] = Point(x, y);

    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";
    }

    return 0;
}

=================
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

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