Cod sursa(job #2625002)
Utilizator | Data | 5 iunie 2020 17:41:02 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | py | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
def corect (S):
n = 0
for i in range (1, 12):
temp = S//(5**i)
n += temp
if temp == 0:
break
return n
inpput = open("fact.in", "r")
ouut = open ("fact.out", "w")
P = int(inpput.readline())
if (P == 0):
ouut.write("1")
#inpput.close()
#ouut.close()
#exit(0)
else:
temp = 5*P
while corect(temp) > P:
temp -= 5
if corect(temp) == P:
temp = str(temp)
ouut.write(temp)
else:
ouut.write("-1")
inpput.close()
ouut.close()
exit(0)