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.
27 lines
374 B
Python
27 lines
374 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)
|
||
|
|
||
|
freq = []
|
||
|
|
||
|
res = 0
|
||
|
i = 0
|
||
|
while True:
|
||
|
if i == len(in_list):
|
||
|
i = 0
|
||
|
res += in_list[i]
|
||
|
|
||
|
freq.append(res)
|
||
|
if len(freq) != len(set(freq)):
|
||
|
break
|
||
|
i += 1
|
||
|
|
||
|
print(res)
|