p = int(''.join(list(input())[2:]))
p /= len(str(p)) * 10
n = int(input())
outp = '0.'
for i in range(n):
prom = p * 8
outp += str(int(prom // 1))
p = prom % 1
for i in range(1, len(outp) - 1):
if outp[-i] == '0':
out = outp[:-i]
else:
break
print(out)
Объяснение:
p = int(''.join(list(input())[2:]))
p /= len(str(p)) * 10
n = int(input())
outp = '0.'
for i in range(n):
prom = p * 8
outp += str(int(prom // 1))
p = prom % 1
for i in range(1, len(outp) - 1):
if outp[-i] == '0':
out = outp[:-i]
else:
break
print(out)
Объяснение: