Crazy Tea Party
Time limit1sMemory limit128 MB
Given n people seated around a circular table, compute the minimum number of adjacent swaps needed to reverse the circular seating order, for many test cases.
- Level
Medium6 of 10
- Topics
- Math, Combinatorics, Simulation
- Solved
- No attempts yet
Problem
The participants of the "crazy tea party" sit around a round table. Each minute, one pair of adjacent neighbours may swap places. Find the minimum time (in minutes) required for all participants to sit in the reverse order, so that each participant's left neighbour becomes their right neighbour and their right neighbour becomes their left.
Input
The first line contains the number of tests. Each of the next lines contains one integer () — the number of crazy-tea participants.
Output
For each number of participants, print on its own line the minimum time required for all participants to sit in the reverse order.