Last active
April 14, 2019 16:41
Revisions
-
elissonmichael revised this gist
Apr 14, 2019 . No changes.There are no files selected for viewing
-
elissonmichael revised this gist
Apr 14, 2019 . No changes.There are no files selected for viewing
-
elissonmichael revised this gist
Apr 14, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
elissonmichael created this gist
Apr 14, 2019 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ (100..999).each do |x| (100..999).each do |y| (100..999).each do |z| soma = x + y + z condicao1 = soma.digits.size == 3 condicao2 = soma.digits.uniq.size == 1 n = soma.digits.uniq.first condicao3 = n == x.digits.first && n == y.digits.first && n == z.digits.first condicao4 = x.digits.last == y.digits.last && y.digits.last == z.digits.last condicao5 = x.digits[1] == y.digits[1] && y.digits[1] == z.digits[1] if condicao1 && condicao2 && condicao3 && condicao4 && condicao5 puts "#{x} + #{y} + #{z} = #{soma}" end end end end