Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Advent Of Code
Aoc Cmorel
Commits
f15a86a5
Commit
f15a86a5
authored
2 years ago
by
MOREL Celestin
Browse files
Options
Download
Email Patches
Plain Diff
avec le script de la partie 1 c est mieux
parent
00b6f810
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
7 deletions
+58
-7
day05/exo5_1.py
day05/exo5_1.py
+4
-7
day05/exo5_2.py
day05/exo5_2.py
+54
-0
No files found.
day05/exo5_1.py
View file @
f15a86a5
...
...
@@ -34,13 +34,10 @@ with open('day05/exo5.txt','r') as file:
if
a
:
instruction
=
ligne
.
split
(
' '
)
n
=
[
int
(
instruction
[
1
]),
int
(
instruction
[
3
]),
int
(
instruction
[
5
][
0
:
-
1
])]
print
(
n
)
print
(
matrice
)
print
(
matrice
[
n
[
1
]
-
1
][(
len
(
matrice
[
n
[
1
]
-
1
])
-
n
[
0
])::])
print
((
len
(
matrice
[
n
[
1
]
-
1
])
-
n
[
0
]))
matrice
[
n
[
2
]
-
1
]
+=
matrice
[
n
[
1
]
-
1
][(
len
(
matrice
[
n
[
1
]
-
1
])
-
n
[
0
])::]
del
matrice
[
n
[
1
]
-
1
][
(
len
(
matrice
[
n
[
1
]
-
1
])
-
n
[
0
])
::]
print
(
'#######'
)
for
ele
in
range
(
n
[
0
]):
matrice
[
n
[
2
]
-
1
].
append
(
matrice
[
n
[
1
]
-
1
].
pop
())
if
ligne
==
'
\n
'
:
...
...
This diff is collapsed.
Click to expand it.
day05/exo5_2.py
0 → 100644
View file @
f15a86a5
"""
[G] [D] [Q]
[P] [T] [L] [M] [Z]
[Z] [Z] [C] [Z] [G] [W]
[M] [B] [F] [P] [C] [H] [N]
[T] [S] [R] [H] [W] [R] [L] [W]
[R] [T] [Q] [Z] [R] [S] [Z] [F] [P]
[C] [N] [H] [R] [N] [H] [D] [J] [Q]
[N] [D] [M] [G] [Z] [F] [W] [S] [S]
"""
from
time
import
time
start
=
time
()
matrice
=
[[]
for
i
in
range
(
9
)]
matrice
[
0
]
=
[
'N'
,
'C'
,
'R'
,
'T'
,
'M'
,
'Z'
,
'P'
]
matrice
[
1
]
=
[
'D'
,
'N'
,
'T'
,
'S'
,
'B'
,
'Z'
]
matrice
[
2
]
=
[
'M'
,
'H'
,
'Q'
,
'R'
,
'F'
,
'C'
,
'T'
,
'G'
]
matrice
[
3
]
=
[
'G'
,
'R'
,
'Z'
]
matrice
[
4
]
=
[
'Z'
,
'N'
,
'R'
,
'H'
]
matrice
[
5
]
=
[
'F'
,
'H'
,
'S'
,
'W'
,
'P'
,
'Z'
,
'L'
,
'D'
]
matrice
[
6
]
=
[
'W'
,
'D'
,
'Z'
,
'R'
,
'C'
,
'G'
,
'M'
]
matrice
[
7
]
=
[
'S'
,
'J'
,
'F'
,
'L'
,
'H'
,
'W'
,
'Z'
,
'Q'
]
matrice
[
8
]
=
[
'S'
,
'Q'
,
'P'
,
'W'
,
'N'
]
with
open
(
'day05/exo5.txt'
,
'r'
)
as
file
:
a
=
False
mot
=
''
for
ligne
in
file
:
if
a
:
instruction
=
ligne
.
split
(
' '
)
n
=
[
int
(
instruction
[
1
]),
int
(
instruction
[
3
]),
int
(
instruction
[
5
][
0
:
-
1
])]
matrice
[
n
[
2
]
-
1
]
+=
matrice
[
n
[
1
]
-
1
][(
len
(
matrice
[
n
[
1
]
-
1
])
-
n
[
0
])::]
del
matrice
[
n
[
1
]
-
1
][
(
len
(
matrice
[
n
[
1
]
-
1
])
-
n
[
0
])
::]
print
(
'#######'
)
if
ligne
==
'
\n
'
:
a
=
True
for
i
in
matrice
:
mot
+=
i
[
-
1
]
print
(
mot
)
end
=
time
()
#print(f'points calculés { m }')
print
(
f
'reponse trouvée en
{
end
-
start
}
sec'
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment