My issue
Chef has made a list for his monthly expenses. The list has
�
N expenses with index
1
1 to
�
N. The money spent on each expense depends upon the monthly income of Chef.
Chef spends
50
%
50% of his total income on the expense with index
1
1.
The money spent on the
�
�
ℎ
i
th
expense
(
�
1
)
(i>1) is equal to
50
%
50% of the amount remaining, after paying for all expenses with indices less than
�
i.
Given that Chef earns
2
�
2
X
rupees in a month, find the amount he saves after paying for all
�
N expenses.
Input Format
The first line of input will contain a single integer
�
T, denoting the number of test cases.
Each test case consists of two space-separated integers
�
N and
�
X — where
�
N denotes the number of expenses and
2
�
2
X
denotes the monthly income of Chef.
Output Format
For each test case, output on a new line, the amount saved by Chef after paying for all
�
N expenses.
Constraints
1
≤
�
≤
1000
1≤T≤1000
1
≤
�
<
�
≤
20
1≤N<X≤20
Sample 1:
Input
Output
4
1 2
1 3
2 3
3 4
2
4
2
2
My code
# Update the code below to solve this problem
t = int(input())
for i in range(t):
N, X = map(int, input().split())
Learning course: Python with Data structures
Problem Link: Review problem - 3 Practice Problem in Python with Data structures - CodeChef