summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKylie McClain <kylie@somas.is>2020-12-01 01:47:06 -0500
committerKylie McClain <kylie@somas.is>2020-12-01 15:47:06 -0500
commita3b79ddace0a47de98c8c9a831e2847254b4279e (patch)
treefb71fd098d644de36d0edb17631a0d9c7361b340
downloadaoc-main.tar.gz
aoc-main.tar.xz
aoc-main.zip
2020: day 1!HEADmain
-rw-r--r--2020/Makefile11
-rwxr-xr-x2020/day112
-rw-r--r--2020/day1.txt200
3 files changed, 223 insertions, 0 deletions
diff --git a/2020/Makefile b/2020/Makefile
new file mode 100644
index 0000000..8534f2f
--- /dev/null
+++ b/2020/Makefile
@@ -0,0 +1,11 @@
+CFLAGS += -std=c99 -D_GNU_SOURCE -Wall -Wextra -Wpedantic -Wshadow -O2 -Werror
+
+all: day1
+
+check-day1: day1
+ ./day1 <day1.txt
+
+check: check-day1
+
+clean:
+ rm -f ${DAYS}
diff --git a/2020/day1 b/2020/day1
new file mode 100755
index 0000000..30e730e
--- /dev/null
+++ b/2020/day1
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -- $(cat)
+
+for a1; do
+ for a2; do
+ for a3; do
+ [ $(( a1 + a2 + a3 )) -eq 2020 ] && break 3
+ done
+ done
+done
+echo $(( a1 * a2 * a3 ))
diff --git a/2020/day1.txt b/2020/day1.txt
new file mode 100644
index 0000000..b221b17
--- /dev/null
+++ b/2020/day1.txt
@@ -0,0 +1,200 @@
+997
+1582
+1790
+1798
+1094
+1831
+1879
+1730
+1995
+1702
+1680
+1869
+1964
+1777
+1862
+1928
+1997
+1741
+1604
+1691
+1219
+1458
+1749
+1717
+1786
+1665
+1724
+1998
+1589
+1828
+1953
+1848
+1500
+1590
+1968
+1948
+1323
+1800
+1986
+679
+1907
+1916
+1820
+1661
+1479
+1808
+1824
+1825
+1952
+1666
+1541
+1791
+1906
+1638
+1557
+1999
+1710
+1549
+1912
+1974
+1628
+1748
+1411
+1978
+1865
+1932
+1839
+1892
+1981
+1807
+357
+912
+1443
+1972
+1816
+1890
+1029
+1175
+1522
+1750
+2001
+1655
+1955
+1949
+1660
+233
+1891
+1994
+1934
+1908
+1573
+1712
+1622
+1770
+1574
+1778
+1851
+2004
+1818
+1200
+1229
+1110
+1005
+1716
+1765
+1835
+1773
+15
+1914
+1833
+1689
+1843
+1718
+1872
+390
+1941
+1178
+1670
+1899
+1864
+1913
+2010
+1855
+1797
+1767
+1673
+1657
+1607
+1305
+1341
+1662
+1845
+1980
+1534
+1789
+1876
+1849
+1926
+1958
+977
+1709
+1647
+1832
+1785
+1854
+1667
+1679
+1970
+1186
+2000
+1681
+1684
+1614
+1988
+1561
+1594
+1636
+1327
+1696
+1915
+1045
+1829
+1079
+1295
+1213
+1714
+1992
+1984
+1951
+1687
+1842
+1792
+87
+1732
+428
+1799
+1850
+1962
+1629
+1965
+1142
+1040
+131
+1844
+1454
+1779
+1369
+1960
+1887
+1725
+1893
+1465
+1676
+1826
+1462
+1408
+1937
+1643
+1069
+1759