### PROBLEM LINK:

**Author:** Yuri Shilyaev

**Tester:** Hasan Jaddouh

**Editorialist:** Yury Shilyaev

### DIFFICULTY:

Easy

### PREREQUISITES:

Simple geometry facts.

### PROBLEM:

You are given a circle with k points on the outline, placed such that the distance between any two adjacent points is equal. The points are enumerated from 1 to k in clockwise manner. Given two points A and B, find the number of points C, such that angle ACB is obtuse.

### QUICK EXPLANATION:

The fact is that all the points C located in one half-plane from line AB have equal angle ACB. So, we have to find the number of points between A and B on the circle. We can do it in O(1), so the total complexity is O(T).

### EXPLANATION:

Lets split the points into two groups: located in one half-plane from line AB and in the other. The smallest group will be the answer â€” all the angles there would be obtuse. As we know, the angle, which leans on the diameter of the circle, is right angle. So we also have to check if AB is diameter, then the answer is 0.

The most simple solution is to transform the problem to the problem, when A = 1 and 2 \le B \le \lfloor{\frac{k}{2}}\rfloor + 1. Now the answer is 0, if B = \frac{k}{2} + 1, and B - 2 otherwise.

### AUTHORâ€™S AND TESTERâ€™S SOLUTIONS:

Authorâ€™s solution can be found here.

Testerâ€™s solution can be found here.