""" [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])] for ele in range(n[0]): matrice[n[2]-1].append(matrice[n[1]-1].pop()) 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')