Calendrier de l'Avent 2017

Discussion à propos de tout ce qui n'entre pas dans le cadre des autres forums.
[ce forum est modéré par les modérateurs globaux du site]
Règles du forum
Merci d'éviter le style SMS dans vos messages et de penser à utiliser la fonction Recherche avant de poster un message. Pour joindre des fichiers à vos messages, consulter ce sujet.

Calendrier de l'Avent 2017

Messagepar OG » Vendredi 01 Décembre 2017, 22:25

Bonsoir

Pour celles et ceux qui ont un peu de temps libre, c'est reparti !
Tout aussi digeste que du chocolat, cela permet de faire du Python tous les jours.
Pour le 1er jour, rien de difficile.

J'ai oublié de mettre le lien !
https://adventofcode.com/2017


--- Day 1: Inverse Captcha ---

The night before Christmas, one of Santa's Elves calls you in a panic. "The printer's broken! We can't print the Naughty or Nice List!" By the time you make it to sub-basement 17, there are only a few minutes until midnight. "We have a big problem," she says; "there must be almost fifty bugs in this system, but nothing else can print The List. Stand in this square, quick! There's no time to explain; if you can convince them to pay you in stars, you'll be able to--" She pulls a lever and the world goes blurry.

When your eyes can focus again, everything seems a lot more pixelated than before. She must have sent you inside the computer! You check the system clock: 25 milliseconds until midnight. With that much time, you should be able to collect all fifty stars by December 25th.

Collect stars by solving puzzles. Two puzzles will be made available on each day millisecond in the advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!

You're standing in a room with "digitization quarantine" written in LEDs along one wall. The only door is locked, but it includes a small interface. "Restricted Area - Strictly No Digitized Users Allowed."

It goes on to explain that you may only leave by solving a captcha to prove you're not a human. Apparently, you only get one millisecond to solve the captcha: too fast for a normal human, but it feels like hours to you.

The captcha requires you to review a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list.

For example:

1122 produces a sum of 3 (1 + 2) because the first digit (1) matches the second digit and the third digit (2) matches the fourth digit.
1111 produces 4 because each digit (all 1) matches the next.
1234 produces 0 because no digit matches the next.
91212129 produces 9 because the only digit that matches the next one is the last digit, 9.

What is the solution to your captcha?

Your puzzle answer was ????
--- Part Two ---

You notice a progress bar that jumps to 50% completion. Apparently, the door isn't yet satisfied, but it did emit a star as encouragement. The instructions change:

Now, instead of considering the next digit, it wants you to consider the digit halfway around the circular list. That is, if your list contains 10 items, only include a digit in your sum if the digit 10/2 = 5 steps forward matches it. Fortunately, your list has an even number of elements.

For example:

1212 produces 6: the list contains 4 items, and all four digits match the digit 2 items ahead.
1221 produces 0, because every comparison is between a 1 and a 2.
123425 produces 4, because both 2s match each other, but no other digit has a match.
123123 produces 12.
12131415 produces 4.

What is the solution to your new captcha?

Your puzzle answer was ?????



O.G.
Dernière édition par OG le Mardi 05 Décembre 2017, 09:07, édité 1 fois.
OG
Modérateur
 
Messages: 2214
Inscription: Lundi 12 Mars 2007, 11:20
Localisation: Rouen
Statut actuel: Actif et salarié | Maître de conférence

Publicité

Re: Calendrier de l'Avent 2017

Messagepar OG » Lundi 04 Décembre 2017, 23:07

Pour le jour 3 (au moins la 1ère partie de l'énigme) pas besoin de Python ou autre langage.
Il faut juste savoir compter, faire une division euclidienne... (avec une machine à calculer tout de même)
--- Day 3: Spiral Memory ---

You come across an experimental new kind of memory stored on an infinite two-dimensional grid.

Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up while spiraling outward. For example, the first few squares are allocated like this:

17 16 15 14 13
18 5 4 3 12
19 6 1 2 11
20 7 8 9 10
21 22 23---> ...

While this is very space-efficient (no squares are skipped), requested data must be carried back to square 1 (the location of the only access port for this memory system) by programs that can only move up, down, left, or right. They always take the shortest path: the Manhattan Distance between the location of the data and square 1.

For example:

Data from square 1 is carried 0 steps, since it's at the access port.
Data from square 12 is carried 3 steps, such as: down, left, left.
Data from square 23 is carried only 2 steps: up twice.
Data from square 1024 must be carried 31 steps.

How many steps are required to carry the data from the square identified in your puzzle input all the way to the access port?

Your puzzle input was 265149.


OG
Modérateur
 
Messages: 2214
Inscription: Lundi 12 Mars 2007, 11:20
Localisation: Rouen
Statut actuel: Actif et salarié | Maître de conférence

Re: Calendrier de l'Avent 2017

Messagepar OG » Jeudi 07 Décembre 2017, 13:35

Jusqu'à présent, mis à part le jour 3, il n'y avait pas beaucoup à réfléchir, c'était surtout manipuler des chaînes de caractères, les transformer, calculer des modulos,
éventuellement utiliser un dictionnaire. Pour le jour 7, c'est peut-être plus amusant, une structure d'arbre mais donnée de façon non structurée,
il faut trouver le "sommet".

https://adventofcode.com/2017/day/7

--- Day 7: Recursive Circus ---

Wandering further through the circuits of the computer, you come upon a tower of programs that have gotten themselves into a bit of trouble. A recursive algorithm has gotten out of hand, and now they're balanced precariously in a large tower.

One program at the bottom supports the entire tower. It's holding a large disc, and on the disc are balanced several more sub-towers. At the bottom of these sub-towers, standing on the bottom disc, are other programs, each holding their own disc, and so on. At the very tops of these sub-sub-sub-...-towers, many programs stand simply keeping the disc below them balanced but with no disc of their own.

You offer to help, but first you need to understand the structure of these towers. You ask each program to yell out their name, their weight, and (if they're holding a disc) the names of the programs immediately above them balancing on that disc. You write this information down (your puzzle input). Unfortunately, in their panic, they don't do this in an orderly fashion; by the time you're done, you're not sure which program gave which information.

For example, if your list is the following:

pbga (66)
xhth (57)
ebii (61)
havc (66)
ktlj (57)
fwft (72) -> ktlj, cntj, xhth
qoyq (66)
padx (45) -> pbga, havc, qoyq
tknk (41) -> ugml, padx, fwft
jptl (61)
ugml (68) -> gyxo, ebii, jptl
gyxo (61)
cntj (57)

...then you would be able to recreate the structure of the towers that looks like this:
Code: Tout sélectionner
                gyxo
              /     
         ugml - ebii
       /      \     
      |         jptl
      |       
      |         pbga
     /        /
tknk --- padx - havc
     \        \
      |         qoyq
      |             
      |         ktlj
       \      /     
         fwft - cntj
              \     
                xhth

In this example, tknk is at the bottom of the tower (the bottom program), and is holding up ugml, padx, and fwft. Those programs are, in turn, holding up other programs; in this example, none of those programs are holding up any other programs, and are all the tops of their own towers. (The actual tower balancing in front of you is much larger.)

Before you're ready to help them, you need to make sure your information is correct. What is the name of the bottom program?



Le fichier contient 1292 lignes...
La seconde partie de l'énigme demande d'utiliser les nombres qui sont après chaque 'nom de sommet', définissent un poids.

Les plus rapides ont mis un peu moins de 10 minutes pour répondre aux deux parties (pour la seule 1èr partie, 2 minutes), ce qui est beaucoup plus que les jours 1,2,4, 5 et 6.

O.G.
OG
Modérateur
 
Messages: 2214
Inscription: Lundi 12 Mars 2007, 11:20
Localisation: Rouen
Statut actuel: Actif et salarié | Maître de conférence


Retourner vers Tribune libre

 


  • Articles en relation
    Réponses
    Vus
    Dernier message

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 2 invités