You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
6 lines
204 B
6 lines
204 B
7 years ago
|
# p ARGF.read.strip.chars.map(&:to_i).each_cons(2).select {|a,b| a == b }.map(&:first).sum
|
||
|
|
||
|
a = ARGF.read.strip.chars.map(&:to_i)
|
||
|
b = a.rotate(a.size/2)
|
||
|
p a.zip(b).select {|a,b| a == b }.map(&:first).sum
|