https://www.codechef.com/problems/FLOW018

The problem has bug in it
Here are two approches to the problem

approch 1

for _ in range(int(input())):
n = int(input())
f = 1
for i in range(1, n + 1):
f *= i
print(f)

approch 2:

for _ in range(int(input())):
n = int(input())
f = n
for i in range(1, n):
f *= i
print(f)

but only approch1 is accepted

The two approaches give different values for N=0, with approach 2’s value being incorrect.

1 Like