-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay6.py
34 lines (24 loc) · 1.18 KB
/
Day6.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
input="""5,4,3,5,1,1,2,1,2,1,3,2,3,4,5,1,2,4,3,2,5,1,4,2,1,1,2,5,4,4,4,1,5,4,5,2,1,2,5,5,4,1,3,1,4,2,4,2,5,1,3,5,3,2,3,1,1,4,5,2,4,3,1,5,5,1,3,1,3,2,2,4,1,3,4,3,3,4,1,3,4,3,4,5,2,1,1,1,4,5,5,1,1,3,2,4,1,2,2,2,4,1,2,5,5,1,4,5,2,4,2,1,5,4,1,3,4,1,2,3,1,5,1,3,4,5,4,1,4,3,3,3,5,5,1,1,5,1,5,5,1,5,2,1,5,1,2,3,5,5,1,3,3,1,5,3,4,3,4,3,2,5,2,1,2,5,1,1,1,1,5,1,1,4,3,3,5,1,1,1,4,4,1,3,3,5,5,4,3,2,1,2,2,3,4,1,5,4,3,1,1,5,1,4,2,3,2,2,3,4,1,3,4,1,4,3,4,3,1,3,3,1,1,4,1,1,1,4,5,3,1,1,2,5,2,5,1,5,3,3,1,3,5,5,1,5,4,3,1,5,1,1,5,5,1,1,2,5,5,5,1,1,3,2,2,3,4,5,5,2,5,4,2,1,5,1,4,4,5,4,4,1,2,1,1,2,3,5,5,1,3,1,4,2,3,3,1,4,1,1"""
input_test = """3,4,3,1,2"""
def compute_until(number):
global input
input_list = list(map(int, input.split(',')))
d = [0] * 9
for i in input_list:
d[i] += 1
res = len(input_list)
for i in range(number):
res += d[0]
e = d.copy()
for i in range(len(d) - 1):
d[i] = e[i + 1]
d[8] = e[0]
d[6] += e[0]
return res
def first_star():
print(f"First star: {compute_until(80)}")
def second_star():
print(f"Second star: {compute_until(256)}")
if __name__ == '__main__':
first_star()
second_star()