codingtests/solutions/ProjectEuler/028/solve.rb
2024-07-01 13:49:44 +00: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