Advertisement
Gosunov

Untitled

Aug 10th, 2023
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. n = int(input())
  2.  
  3. def main():
  4.     if n == 1:
  5.         print(1)
  6.         return
  7.  
  8.     def f(x):
  9.         global n
  10.         k = 0
  11.         while n % x == 0:
  12.             k += 1
  13.             n //= x
  14.         return k
  15.  
  16.     s = ""
  17.     cnt2, cnt3 = f(2), f(3)
  18.     s += "8" * (cnt2 // 3)
  19.     s += "9" * (cnt3 // 2)
  20.     s += ["", "2", "4", "3", "6", "26"][cnt3 % 2 * 3 + cnt2 % 3]
  21.     s += "5" * f(5)
  22.     s += "7" * f(7)
  23.     if n != 1:
  24.         print("лимитированная партия")
  25.         return
  26.     print(''.join(sorted(s)))
  27.  
  28. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement