Skip to content

Instantly share code, notes, and snippets.

@lune-sta
Created August 22, 2012 11:12
Show Gist options
  • Select an option

  • Save lune-sta/3424527 to your computer and use it in GitHub Desktop.

Select an option

Save lune-sta/3424527 to your computer and use it in GitHub Desktop.
Project Euler 31-2
ans = 0
(0).step(200,100) do |p100|
(0).step(200,50) do |p50|
(0).step(200,20) do |p20|
(0).step(200,10) do |p10|
(0).step(200,5) do |p5|
(0).step(200,2) do |p2|
ans += 1 if p100+p50+p20+p10+p5+p2 <= 200
end
end
end
end
end
end
puts ans+1 # 73682
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment