You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
365 B
Python
28 lines
365 B
Python
#!/usr/bin/env python3
|
|
|
|
with open('input.txt', 'r') as f:
|
|
in_list = f.readlines()
|
|
|
|
|
|
in_list = [x.strip() for x in in_list]
|
|
|
|
in_list = [int(x) for x in in_list]
|
|
# print(in_list)
|
|
|
|
freq = set()
|
|
|
|
res = 0
|
|
i = 0
|
|
while True:
|
|
if i == len(in_list):
|
|
i = 0
|
|
res += in_list[i]
|
|
|
|
if res in freq:
|
|
break
|
|
|
|
freq.add(res)
|
|
i += 1
|
|
|
|
print(res)
|