fork download
  1. # your code goes here
  2. from sys import stdin
  3. i=1
  4.  
  5. for line in stdin:
  6. if line == '': # If empty string is read then stop the loop
  7. break
  8. a=int(line.strip())
  9. b=int(a**(0.334))
  10. ct=1
  11. while(b**3!=a):
  12. ct+=1
  13. a=a-(b**3)
  14. b=int(a**(1./3.))
  15. print("Case #",i,": ",ct,sep="")
  16. i+=1
Success #stdin #stdout 0.04s 9808KB
stdin
1
2
5
8
35
stdout
Case #1: 1
Case #2: 2
Case #3: 5
Case #4: 1
Case #5: 2