This commit is contained in:
Sebastian Seedorf
2020-12-01 22:14:16 +01:00
commit 7c19b98694
8 changed files with 276 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

6
.idea/misc.xml generated Normal file
View File

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

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/python-aoc-2020.iml" filepath="$PROJECT_DIR$/python-aoc-2020.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

200
day01/input.txt Normal file
View File

@@ -0,0 +1,200 @@
1801
1324
1924
1848
1735
1721
1948
1667
1832
1773
1972
1777
1866
1850
1786
1617
1806
1923
789
1645
1530
1989
1720
1681
1807
1716
1935
1944
1878
1859
1602
1154
1824
1993
1952
1849
1695
523
1845
1879
1744
1374
1567
1725
1986
2006
1739
1751
1709
1800
2008
1715
1728
1677
1388
1815
1750
1827
1737
1819
1916
1909
1726
1753
1899
1981
1558
1852
1762
551
1881
1891
1957
1976
1383
1847
1968
1736
1828
1851
1975
1794
1785
1837
1979
1798
1789
1534
1877
1724
1843
1812
1743
1951
1900
1887
1766
1991
1839
1700
1858
1864
2004
1870
1985
1919
1466
1754
1964
946
1907
1942
1911
321
1930
1854
1644
1757
1719
1741
1853
1706
1659
1945
1821
1950
1761
1838
1770
1927
1447
1803
2000
2010
1765
1691
1742
1936
1929
1902
1539
1816
1553
1982
1813
1896
1772
267
1829
1912
1787
1782
1763
1461
1883
1894
2005
1758
1717
1749
1733
1775
1767
1705
1959
1903
1880
2003
1544
1732
1833
1926
1980
1946
1978
1710
1831
1906
1922
1861
1694
1875
307
1920
1934
1966
1804
1799
1548
1871
1769
1997
1639
1830
917
1797
1672
1921
1965
1662

18
day01/part1.py Normal file
View File

@@ -0,0 +1,18 @@
items = [int(x.strip()) for x in open("input.txt")]
lows = []
highs = []
for item in items:
if item < 1010:
lows.append(item)
else:
highs.append(item)
print(lows)
print(highs)
for low in lows:
for high in highs:
if low + high == 2020:
print("Found {} and {}: Sum={} Product={}".format(low, high, low+high, low*high))

14
day01/part2.py Normal file
View File

@@ -0,0 +1,14 @@
import math
from itertools import combinations
items = [int(x.strip()) for x in open("input.txt")]
COUNT = 3
for vals in combinations(items, 3):
if sum(vals) == 2020:
print("Found {} and {} and {}: Sum={} Product={}".format(
*vals,
sum(vals),
math.prod(vals)
))

16
python-aoc-2020.iml Normal file
View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python">
<configuration sdkName="Python 3.6" />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 3.6 interpreter library" level="application" />
</component>
</module>