Skip to content

Instantly share code, notes, and snippets.

@inage
Created December 7, 2013 14:06
Show Gist options
  • Select an option

  • Save inage/7841847 to your computer and use it in GitHub Desktop.

Select an option

Save inage/7841847 to your computer and use it in GitHub Desktop.
くじ引き
## くじ引き
## http://rubyfiddle.com/riddles/c4cf7
n = 3
m = 9
k = [ 1 , 3 , 5]
ans = ""
k.repeated_combination(4){|a,b,c|
if (a+b+c) == m
ans = "Yes"
break
else
ans = "No"
end
}
puts ans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment