Skip to content

Instantly share code, notes, and snippets.

@inage
Last active November 9, 2017 16:01
Show Gist options
  • Save inage/7843395 to your computer and use it in GitHub Desktop.
Save inage/7843395 to your computer and use it in GitHub Desktop.
三角形
## 三角形
## http://rubyfiddle.com/riddles/6bad3
a = [2, 3, 4, 5, 10]
ans = 0
a.combination(3){|v,j,k|
if k < (v+j)
if ans < (v+j+k)
ans = (v+j+k)
end
end
}
puts ans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment