euler/e067.py
Correl Roush da639adddb Problem 067, brought to you by 018
git-svn-id: file:///srv/svn/euler@45 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
2010-04-12 21:13:21 +00:00

13 lines
No EOL
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])