Advertisement
namemkazaza

AC

Oct 19th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. from math import *
  2. def solve(n, a, t):
  3.     c = n
  4.     d = t
  5.     while c > 0:
  6.         if d > 0:
  7.             x = trunc(float('{0:.11f}'.format((c ** (1 / 3))))) - 1
  8.             d -= 1
  9.         else:
  10.             x = trunc(float('{0:.11f}'.format((c ** (1 / 3)))))
  11.         if x <= 1:
  12.             x = trunc(float('{0:.11f}'.format((c ** (1 / 3)))))
  13.         if d > x:
  14.             print(0)
  15.             exit(0)
  16.         a.append(x ** 3)
  17.         c -= x ** 3
  18.         if len(a) > 7:
  19.             a.clear()
  20.             solve(n, a, t + 1)
  21.     print(*a)
  22.     exit(0)
  23. a = []
  24. n = int(input())
  25. t = 0
  26. solve(n, a, t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement