diff --git a/d06/d06_1.py b/d06/d06_1.py new file mode 100644 index 0000000..60f02d0 --- /dev/null +++ b/d06/d06_1.py @@ -0,0 +1,7 @@ +L=list(map(int,__import__("sys").stdin.read().split(","))) +for i in range(80): + L = [ (l-1) for l in L ] + n = sum( l < 0 for l in L) + L = [ l if l>=0 else 6 for l in L ] + L += [8]*n +print(len(L)) diff --git a/d06/d06_2.py b/d06/d06_2.py new file mode 100644 index 0000000..e194989 --- /dev/null +++ b/d06/d06_2.py @@ -0,0 +1,9 @@ +D ={ i:0 for i in range(9) } +for l in list(map(int,__import__("sys").stdin.read().split(","))): + D[l]+=1 +for i in range(256): + D = { i-1:D[i] for i in range(9) } + D[6] += D[-1] + D[8] = D[-1] + del D[-1] +print(sum(D.values())) diff --git a/d06/input b/d06/input new file mode 100644 index 0000000..95c9bd4 --- /dev/null +++ b/d06/input @@ -0,0 +1 @@ +1,1,1,1,1,1,1,4,1,2,1,1,4,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,3,1,1,2,1,2,1,3,3,4,1,4,1,1,3,1,1,5,1,1,1,1,4,1,1,5,1,1,1,4,1,5,1,1,1,3,1,1,5,3,1,1,1,1,1,4,1,1,1,1,1,2,4,1,1,1,1,4,1,2,2,1,1,1,3,1,2,5,1,4,1,1,1,3,1,1,4,1,1,1,1,1,1,1,4,1,1,4,1,1,1,1,1,1,1,2,1,1,5,1,1,1,4,1,1,5,1,1,5,3,3,5,3,1,1,1,4,1,1,1,1,1,1,5,3,1,2,1,1,1,4,1,3,1,5,1,1,2,1,1,1,1,1,5,1,1,1,1,1,2,1,1,1,1,4,3,2,1,2,4,1,3,1,5,1,2,1,4,1,1,1,1,1,3,1,4,1,1,1,1,3,1,3,3,1,4,3,4,1,1,1,1,5,1,3,3,2,5,3,1,1,3,1,3,1,1,1,1,4,1,1,1,1,3,1,5,1,1,1,4,4,1,1,5,5,2,4,5,1,1,1,1,5,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,5,1,1,1,1,1,1,3,1,1,2,1,1 diff --git a/d06/sample b/d06/sample new file mode 100644 index 0000000..a7af2b1 --- /dev/null +++ b/d06/sample @@ -0,0 +1 @@ +3,4,3,1,2 \ No newline at end of file