Restructuring
This commit is contained in:
12
solutions/ProjectEuler/028/solve.rb
Normal file
12
solutions/ProjectEuler/028/solve.rb
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
SIZE = 1001
|
||||
SIDES = 4
|
||||
sum = 1;
|
||||
result=1;
|
||||
(2...SIZE).step(2) { |add|
|
||||
SIDES.downto(1) {
|
||||
sum += add;
|
||||
result += sum;
|
||||
}
|
||||
}
|
||||
puts result
|
Reference in New Issue
Block a user