Submission

Status:
PPPPPPPPPP

Score: 100

User: gay69

Problemset: D.Think Sol!

Language: cpp

Time: 0.087 second

Submitted On: 2024-10-15 19:09:19

#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plpll;
typedef pair<ll, plpll> plplpll;

const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll maxn = 5e5 + 5;

void mains() {
    long double n, m;
    ll q;
    cin >> n >> m >> q;
    long double angle = 360.0 / (n / 2), angle2 = 360.0 / m;
    cout << fixed << setprecision(12);
    for (int i = 0; i < q; i++) {
        long double x, y;
        cin >> x >> y;
        if (x >= n / 2) {
            x -= n / 2;
        }
        long double cur = abs(x * angle + angle / m * y - (y * angle2));
        cout << min(cur, 360.0 - cur) << "\n";
    }
}

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

    ll t = 1;
    // cin >> t;
    while (t--) {
        mains();
    }
    return 0;
}