codingtests/ProjectEuler/009/solve.rb
2012-03-07 11:33:15 +01:00

10 lines
147 B
Ruby

(1..1000).each do |a|
(1..1000).each do |b|
c = 1000 - a - b
if( a ** 2 + b ** 2 == c ** 2)
puts a * b *c
exit
end
end
end