#P11003. [蓝桥杯 2024 省 Python B] 蓝桥村的真相
[蓝桥杯 2024 省 Python B] 蓝桥村的真相
Problem Description
In the scenic Lanqiao Village, villagers sit around an old round table and take part in a battle of ideas. Each villager has a clear identity: either an honest person who always tells the truth, or a hopeless liar who always lies.
When the meeting begins, a debate about truth and falsehood starts. Each villager speaks in turn. Villager makes the following claim: among the next two villagers after him—namely, villager and villager (note that the numbering is circular, so if is the last one, then is the first one, and so on)—one is telling the truth and the other is lying.
Among all these uncertain statements, how many true words are hidden behind the veil of lies?
Please explore every possible arrangement of truth and falsehood, and compute, over all possible truth/lie arrangements, the total number of liars.
Input Format
The first line contains an integer , indicating that each input contains test cases.
Then test cases follow.
Each test case consists of one line containing an integer , representing the number of villagers.
Output Format
Output lines. Each line contains an integer, representing the answer for each test case in order.
2
3
3
6
6
Hint
For of the test cases, , .
For of the test cases, , .
For all test cases, , .
Sample Explanation
In the sample, the possible arrangements are “false, false, false”, “true, true, false”, “true, false, true”, “false, true, true”. The total number of liars is .
Translated by ChatGPT 5