This commit is contained in:
BarsTiger
2021-10-15 12:46:53 +03:00
parent b9772007b3
commit 68fb5410ee
45 changed files with 729 additions and 16 deletions

View File

@@ -0,0 +1,21 @@
chisloVV = int(input())
deystviy = 0
while chisloVV != 1:
if chisloVV % 3 == 0:
chisloVV = chisloVV / 3
deystviy += 1
elif (chisloVV + 1) % 3 == 0:
chisloVV = (chisloVV + 1) / 3
deystviy += 2
elif (chisloVV - 1) % 3 == 0:
chisloVV = (chisloVV - 1) / 3
deystviy += 2
else:
chisloVV = chisloVV - 1
deystviy += 1
print(deystviy)