fork(3) download
  1. number = 80
  2.  
  3. arr = Array.new number.succ, Array.new
  4. arr[1], arr[2] = [[1]], [[2]]
  5.  
  6. 3.upto(number) do |c|
  7. 1.upto(c / 2) do |i|
  8. arr[c] += arr[c-i].reject { |sub_arr| sub_arr.any? { |e| i >= e } }
  9. .map { |sub_arr| sub_arr.dup.unshift i }
  10. end
  11. arr[c] << [c]
  12. end
  13.  
  14. puts arr[number].count, ''
  15. #print arr[number]
Success #stdin #stdout 3.43s 140736KB
stdin
Standard input is empty
stdout
77312