Compute the Combination

Limits: 2s, 512 MB

Let P = C(N,0) - C(N,1) + C(N,2) - C(N,3) + … + C(N,N); where C(n,r) is “n choose r”.


This is a companion discussion topic for the original entry at https://toph.co/p/compute-the-combination
1 Like

test=int(input())
for i in range(test):
number=int(input())
print(0)
i have tried solving this problem using the above algorithm, which obviously yields the correct answer for test case 1, but it says 'CPU LIMIT EXCEEDED ’ for the second test case. How is it possible?

This problem’s judge-dataset is huge. So this problem can not be solved using Python, within the time limit. :cold_sweat:

Although your approach is incorrect.

I used a different algorithm before, but even that got the same response. Anyway Thanks bro