Skip to content

Instantly share code, notes, and snippets.

@kota kota/lottery.rb
Created May 31, 2016

Embed
What would you like to do?
#MAX = 10000000
#n = 10
#m = rand(MAX)
#k = [rand(MAX)] * n
m = 10
k = [1,2,3,4,5,6,7,8,9]
k.combination(4) do |k1,k2,k3,k4|
if k1 + k2 + k3 + k4 == m
puts "YES"
exit
end
end
puts "NO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.