mirror of
https://github.com/correl/euler.git
synced 2024-11-30 19:19:54 +00:00
13 lines
377 B
Python
13 lines
377 B
Python
|
from e018 import Triangle
|
||
|
vertex_data = []
|
||
|
with open('p067/triangle.txt', 'r') as f:
|
||
|
while True:
|
||
|
line = f.readline()
|
||
|
if not line:
|
||
|
break
|
||
|
vertex_data = vertex_data + [int(v) for v in line.split(' ')]
|
||
|
t = Triangle(vertex_data)
|
||
|
t.find_path()
|
||
|
path = t.get_path()
|
||
|
print 'Path', [v.value for v in path]
|
||
|
print 'Sum', sum([v.value for v in path])
|