fork download
  1. while x = gets
  2. t = []
  3. x = x.to_i
  4. p = Math.sqrt(x)
  5. p = p.to_i
  6. w = x % p
  7. if w == 0
  8. n = 1
  9. else
  10. n = 0
  11. end
  12. i = 1
  13. while i<= p
  14. if x % i == 0
  15. t = t.push(i)
  16. puts i
  17. end
  18. i = i + 1
  19. end
  20. d = t.length + 1
  21. i1 = d - 1 - n
  22. puts d
  23. print t
  24. end
Success #stdin #stdout 0s 4760KB
stdin
24
stdout
1
2
3
4
5
[1, 2, 3, 4]