#P7573. 「PMOI-3」公平正义
「PMOI-3」公平正义
Description
There are now people, and lhm has a cake of mass . Everyone wants to eat lhm’s cake. To maintain fairness and justice, lhm needs to use the minimum number of cuts to divide the cake into equal shares (one share may contain multiple pieces).
Treat the cake as a circle. Note that each time you cut the cake, you can only cut along a diameter.
In the end, the number of pieces each person gets may be different, but you must ensure that each person receives mass .
You need to find the minimum number of cuts lhm needs to make.
Input Format
This problem contains multiple test cases.
The input has lines.
The first line contains an integer , representing the number of test cases.
The next lines each contain an integer , representing the number of people.
Output Format
Output lines. Each line contains a positive integer, representing the answer.
2
2
3
1
2
Hint
[Sample Explanation]
When , we cut directly along a diameter, obtaining two cake pieces each of mass . Give them to the two people.
When , we can cut along two diameters with an angle of between them, obtaining two pieces of mass and two pieces of mass . We give to the first person, and give to the second and third person respectively, achieving fairness and justice.
[Constraints]
For of the testdata, .
For another of the testdata, .
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号