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

6 years ago
#!/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)
6 years ago
freq = set()
6 years ago
res = 0
i = 0
while True:
if i == len(in_list):
i = 0
res += in_list[i]
if res in freq:
6 years ago
break
freq.add(res)
6 years ago
i += 1
print(res)