Day 1 (part 2 renaming)

This commit is contained in:
Sebastian Seedorf
2020-12-02 11:54:25 +01:00
parent a6645ee697
commit 414cbef549
2 changed files with 4 additions and 4 deletions

2
.idea/misc.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="Python 3.8" project-jdk-type="Python SDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

View File

@@ -7,8 +7,8 @@ tree = dict()
def tree_up(idx, step=1, offset = 0): def tree_up(idx, step=1, offset = 0):
print(idx, step) print(idx, step)
next = tree[(idx, step)] if (idx, step) in tree else None nxt = tree[(idx, step)] if (idx, step) in tree else None
appendix = [] if next is None else tree_up(next+idx, step=step+1, offset=idx) appendix = [] if nxt is None else tree_up(nxt+idx, step=step+1, offset=idx)
return [idx - offset] + appendix return [idx - offset] + appendix
@@ -23,7 +23,7 @@ for item in items:
sum(vals), sum(vals),
math.prod(vals) math.prod(vals)
)) ))
exit(0) exit()
elif new[0] < 0 or new[1] < 0: elif new[0] < 0 or new[1] < 0:
# target value too low or to many sums # target value too low or to many sums
continue continue