adventofcode/2016/day04/problem

77 lines
2.7 KiB
Plaintext
Raw Normal View History

Advent of Code
--- Day 4: Security Through Obscurity ---
2018-03-15 16:24:23 +00:00
Finally, you come across an information kiosk with a list of rooms. Of
course, the list is encrypted and full of decoy data, but the instructions
to decode the list are barely hidden nearby. Better remove the decoy data
first.
2018-03-15 16:24:23 +00:00
Each room consists of an encrypted name (lowercase letters separated by
dashes) followed by a dash, a sector ID, and a checksum in square brackets.
2018-03-15 16:24:23 +00:00
A room is real (not a decoy) if the checksum is the five most common letters
in the encrypted name, in order, with ties broken by alphabetization. For
example:
 aaaaa-bbb-z-y-x-123[abxyz] is a real room because the most common
letters are a (5), b (3), and then a tie between x, y, and z, which are
listed alphabetically.
 a-b-c-d-e-f-g-h-987[abcde] is a real room because although the letters
are all tied (1 of each), the first five are listed alphabetically.
 not-a-real-room-404[oarel] is a real room.
2018-03-15 16:24:23 +00:00
 totally-real-room-200[decoy] is not.
Of the real rooms from the list above, the sum of their sector IDs is 1514.
What is the sum of the sector IDs of the real rooms?
2018-03-15 16:24:23 +00:00
Your puzzle answer was 245102.
The first half of this puzzle is complete! It provides one gold star: *
--- Part Two ---
2018-03-15 16:24:23 +00:00
With all the decoy data out of the way, it's time to decrypt this list and
get moving.
2018-03-15 16:24:23 +00:00
The room names are encrypted by a state-of-the-art shift cipher, which is
nearly unbreakable without the right software. However, the information
kiosk designers at Easter Bunny HQ were not expecting to deal with a master
cryptographer like yourself.
2018-03-15 16:24:23 +00:00
To decrypt a room name, rotate each letter forward through the alphabet a
number of times equal to the room's sector ID. A becomes B, B becomes C, Z
becomes A, and so on. Dashes become spaces.
2018-03-15 16:24:23 +00:00
For example, the real name for qzmt-zixmtkozy-ivhz-343 is very encrypted
name.
What is the sector ID of the room where North Pole objects are stored?
Although it hasn't changed, you can still get your puzzle input.
2018-03-15 16:24:23 +00:00
Your puzzle answer was 324.
References
Visible links
. http://adventofcode.com/
. http://adventofcode.com/2016/about
. http://adventofcode.com/2016/support
. http://adventofcode.com/2016/events
. http://adventofcode.com/2016/settings
. http://adventofcode.com/2016/auth/logout
. http://adventofcode.com/2016
. http://adventofcode.com/2016
. http://adventofcode.com/2016/leaderboard
. http://adventofcode.com/2016/stats
. http://adventofcode.com/2016/sponsors
. http://adventofcode.com/2016/sponsors
. http://www.novetta.com/careers/#opportunities
. https://en.wikipedia.org/wiki/Caesar_cipher
. http://adventofcode.com/2016/day/4/input