Pagini recente » Cod sursa (job #1540346) | Cod sursa (job #1523848) | Cod sursa (job #723196) | Cod sursa (job #1591469) | Cod sursa (job #2590630)
with open('fact.in', 'r') as f:
nr= int(f.readline())
def fact(n):
prod = 1
for i in range(1,n+1):
prod*=i
return prod
def finalZ(n):
total = 0
while n%10 == 0:
total+=1
n = n/10
return total
def finalnZ(n):
total = 0
while n%10 == 0:
n = n/10
return n%10
lastnz = 1
totalz = 0
n = 2
while totalz != nr:
lastdigit = lastnz*n
totalz += finalZ(lastdigit)
lastnz = finalnZ(lastdigit)
n+=1
with open("fact.out", 'w') as g:
g.write(str(n-1))