initial commit
This commit is contained in:
commit
27fe77bbe1
134 changed files with 21939 additions and 0 deletions
106
2020/Day10/input.txt
Normal file
106
2020/Day10/input.txt
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
145
|
||||
3
|
||||
157
|
||||
75
|
||||
84
|
||||
141
|
||||
40
|
||||
20
|
||||
60
|
||||
48
|
||||
15
|
||||
4
|
||||
2
|
||||
21
|
||||
129
|
||||
113
|
||||
54
|
||||
28
|
||||
69
|
||||
42
|
||||
34
|
||||
1
|
||||
155
|
||||
63
|
||||
151
|
||||
8
|
||||
139
|
||||
135
|
||||
33
|
||||
81
|
||||
70
|
||||
132
|
||||
150
|
||||
112
|
||||
102
|
||||
59
|
||||
154
|
||||
53
|
||||
144
|
||||
149
|
||||
116
|
||||
13
|
||||
41
|
||||
156
|
||||
85
|
||||
22
|
||||
165
|
||||
51
|
||||
14
|
||||
125
|
||||
52
|
||||
64
|
||||
16
|
||||
134
|
||||
110
|
||||
71
|
||||
107
|
||||
124
|
||||
164
|
||||
160
|
||||
10
|
||||
25
|
||||
66
|
||||
74
|
||||
161
|
||||
111
|
||||
122
|
||||
166
|
||||
140
|
||||
87
|
||||
126
|
||||
123
|
||||
146
|
||||
35
|
||||
91
|
||||
106
|
||||
133
|
||||
26
|
||||
77
|
||||
19
|
||||
86
|
||||
105
|
||||
39
|
||||
99
|
||||
76
|
||||
58
|
||||
31
|
||||
96
|
||||
78
|
||||
88
|
||||
168
|
||||
119
|
||||
27
|
||||
45
|
||||
9
|
||||
92
|
||||
138
|
||||
38
|
||||
97
|
||||
32
|
||||
7
|
||||
98
|
||||
167
|
||||
95
|
||||
55
|
||||
65
|
||||
24
2020/Day10/main.py
Normal file
24
2020/Day10/main.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import collections
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
with open("input.txt") as f:
|
||||
raw = [0]
|
||||
for i in f.read().splitlines():
|
||||
raw.append(int(i))
|
||||
raw = sorted(raw)
|
||||
raw.append(max(raw) + 3)
|
||||
|
||||
diffs = []
|
||||
for i in range(1, len(raw)):
|
||||
diffs.append(raw[i] - raw[i - 1])
|
||||
|
||||
diff_counter = collections.Counter(diffs)
|
||||
print(diff_counter[1] * diff_counter[3])
|
||||
|
||||
ways = [1] + [0]*raw[-1]
|
||||
|
||||
for i in raw[1:]:
|
||||
ways[i] = ways[i-1] + ways[i-2] + ways[i-3]
|
||||
|
||||
print(ways[-1])
|
||||
Loading…
Add table
Add a link
Reference in a new issue