Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: anonymous

Problemset: D.Think Sol!

Language: cpp

Time: 0.253 second

Submitted On: 2026-10-22 10:47:20

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

int main(){
    double h,m; cin >> h >> m;
    int t; cin >> t;

    for(int i=0;i<t;i++){
        double a,b; cin >> a >> b;

        if(a >= h/2) a -= h/2;
        double ans = abs(a * 360 / (h/2) + 360 / (h/2) / m * b - (b * 360 / m));
        cout << fixed << setprecision(12) << min(ans,360 - ans) << '\n';
    }

}