completed 2017-02.2
This commit is contained in:
parent
0478a8789a
commit
8ec6322f51
21
2017/02/2checksum.py
Executable file
21
2017/02/2checksum.py
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
if __name__ == '__main__':
|
||||
total = 0
|
||||
with open("input", "r", encoding="utf-8") as sheet:
|
||||
remainder = []
|
||||
for line in sheet:
|
||||
values = list(map(int, line.split()))
|
||||
values.sort()
|
||||
result = ""
|
||||
i = 1
|
||||
while i < len(values) and result == "":
|
||||
j = 0
|
||||
while j >= 0 and j < i and result == "":
|
||||
remainder = values[i] % values[j]
|
||||
if remainder == 0:
|
||||
result = int(values[i] / values[j])
|
||||
j += 1
|
||||
i += 1
|
||||
total += result
|
||||
print(total)
|
Loading…
x
Reference in New Issue
Block a user