Added info to readmes

This commit is contained in:
matthias@arch 2022-12-04 01:07:50 +01:00
parent bdd03ceff2
commit 09a0fa364d
4 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,10 @@
# [Day 1](https://adventofcode.com/2022/day/1) # [Day 1](https://adventofcode.com/2022/day/1)
:gift: :gift:
Today's language: **awk** + **GNU-coretils** Today's language: **awk** + **GNU-coretils**
- Task 1: We use awk to find the maximum while we iterate through over the file
- Task 2: We use awk again for summing the calories, then sort them and take the top 3 which we again sum up with awk
```shell ```shell
# Find the Elf carrying the most Calories. How many total Calories is that Elf carrying? # Find the Elf carrying the most Calories. How many total Calories is that Elf carrying?
awk -f day1-1.awk input.txt awk -f day1-1.awk input.txt

View File

@ -1,6 +1,9 @@
# [Day 2](https://adventofcode.com/2022/day/2) # [Day 2](https://adventofcode.com/2022/day/2)
:gift::gift: :gift::gift:
Today's language: **C++** Today's language: **C++**
We use that chars are just numbers, so we can easily convert them into the respective points by just subtracting `'A'` or `'X'`.
The rest is then just a few `if else`s.
```shell ```shell
# What would your total score be if everything goes exactly according to your strategy guide? # What would your total score be if everything goes exactly according to your strategy guide?
g++ main.cpp -o day2 g++ main.cpp -o day2

View File

@ -1,6 +1,9 @@
# [Day 3](https://adventofcode.com/2022/day/3) # [Day 3](https://adventofcode.com/2022/day/3)
:gift::gift::gift: :gift::gift::gift:
Today's language: **C** Today's language: **C**
All the characters (the Elf's items) occuring in (half) a line (backpack) are stored as bits in an unsigned long, duplicate characters can then be determined by bitwise and-ing these numbers.
```shell ```shell
# Find the item type that appears in both compartments of each rucksack. What is the sum of the priorities of those item types? # Find the item type that appears in both compartments of each rucksack. What is the sum of the priorities of those item types?
gcc main.c -o day3 gcc main.c -o day3

View File

@ -3,6 +3,6 @@ This is a repository for my solutions for the [advent of code 2022](https://adve
I will try to use as many different languages am not necessarily trying to do it the best or most efficient way, I will try to use as many different languages am not necessarily trying to do it the best or most efficient way,
Also, checkout the repositories of my friends who do stuff in go and Visual Basic: Also, checkout the repositories of my friends who do stuff in go, Visual Basic and php:
- [Daniel](https://git.quintern.xyz/TheShinyMelon/AOC_2022) - [Daniel](https://git.quintern.xyz/TheShinyMelon/AOC_2022)
- [Jonas](https://github.com/JonasBordewick/advent_of_code_2022) - [Jonas](https://github.com/JonasBordewick/advent_of_code_2022)