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.
13 lines
186 B
13 lines
186 B
9 months ago
|
input = ARGF.read.strip.split(?,).map(&:chars)
|
||
|
|
||
|
# part one
|
||
|
p input.sum {|str|
|
||
|
current = 0
|
||
|
str.each do |c|
|
||
|
current += c.ord
|
||
|
current *= 17
|
||
|
current %= 256
|
||
|
end
|
||
|
current
|
||
|
}
|