fork(1) download
  1. from math import pow
  2.  
  3.  
  4. def foo(num):
  5. num_cube_root = pow(num, 1.0 / 3)
  6. # First round upto 11 decimal places
  7. num_cube_root = "%.11f" % (num_cube_root)
  8. # Then remove the last decimal digit
  9. # to achieve a truncation of 10 decimal places
  10. num_cube_root = str(num_cube_root)[0:-1]
  11.  
  12. num_cube_root_sum = 0
  13. for digit in num_cube_root:
  14. if digit != '.':
  15. num_cube_root_sum += int(digit)
  16. num_cube_root_sum %= 10
  17.  
  18. return (num_cube_root_sum, num_cube_root)
  19.  
  20.  
  21. def main():
  22. # Number of test cases
  23. t = int(input())
  24. while t:
  25. t -= 1
  26. num = input().strip()
  27. # If line empty, ignore
  28. if not num:
  29. t += 1
  30. continue
  31.  
  32. num = int(num)
  33. ans = foo(num)
  34. print(str(ans[0]) + " " + ans[1])
  35.  
  36.  
  37. if __name__ == '__main__':
  38. main()
  39.  
Success #stdin #stdout 0.02s 9936KB
stdin
5
1

        8

   1000


2
33076161
stdout
1 1.0000000000
2 2.0000000000
1 10.0000000000
0 1.2599210498
6 321.0000000000