Mr Ishtiaque is in trouble. A few months ago, he bought 2 rabbits. He wanted to have two pet rabbits…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
I wanted to say that, the main solve is O(n) and as there are test cases, So the full solve becomes O(n*t). For the worst case, can it work in 1 second?
Increase the time limit for python.
Here is my code: [It’s getting cle in last case]
num_test = int(input())
for i in range(num_test):
a, b, c = map(int, input().split())
num_rabbit = a
for j in range(1, c):
num_rabbit += a * b**j
print(num_rabbit)