Problem 9
Problem 9 - PukiWiki
sum =1000 (1..(sum/3).to_i).each{|a| ((a+1)..((sum-a)/2).to_i).each{|b| c = sum -a -b p a*b*c and return if (a**2 + b**2 == c ** 2) } }
答え:31875000
Problem 9 - PukiWiki
sum =1000 (1..(sum/3).to_i).each{|a| ((a+1)..((sum-a)/2).to_i).each{|b| c = sum -a -b p a*b*c and return if (a**2 + b**2 == c ** 2) } }
答え:31875000