codingtests/ProjectEuler/028/solve.rb
2011-04-24 16:22:52 +02:00

12 lines
147 B
Ruby

SIZE = 1001
SIDES = 4
sum = 1;
result=1;
(2...SIZE).step(2) { |add|
SIDES.downto(1) {
sum += add;
result += sum;
}
}
puts result