blob: d48de476c642bfddfbb0e2b5e0bcc9043081fa8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/bin/env ruby
input = $stdin.readlines.map(&:to_i)
lf = 0
freq = [0]
loop do
input.each do |i|
lf += i
if freq.include?(lf)
puts lf
exit
end
freq << lf
end
end
|