Problem E. Passenger Paradox
Xem dạng PDFTrong trường hợp đề bài hiển thị không chính xác, bạn có thể tải đề bài tại đây: Đề bài
On an experimental at UMT University, a smart bus system was designed to manage boarding and disembarking in an unusual way. At each stop, exactly half of the passengers on the bus - plus half a passenger (somehow) - get off.
This process continues identically for k consecutive stops. Remarkably, the bus is completely empty after the last stop, and no passenger was partially harmed or cut - the system somehow ensures integer behavior all along.
Given the number of stops k, can you determine the initial number of passengers n required such that the bus ends up empty under this strange pattern?
Input
The first line contains an integer ~T~ - the number of test cases.
Each of the following T lines contains a single integer ~k~ ~(1 ≤ k ≤ 30)~, the number of stops.
Output
For each test case, print the initial number of passengers n such that the bus becomes empty after exactly k stops.
Sample Input 1
2
1
3
Sample Ouput 1
1
7
Bình luận