Not everything done
This commit is contained in:
commit
2773df212e
16 changed files with 8761 additions and 0 deletions
93
aoc1.ipynb
Normal file
93
aoc1.ipynb
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "335e32f0-2c5a-4f77-84dd-66c2266e6312",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"id": "42055a53-b495-4615-bdb4-eaddd9380e92",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"72602"
|
||||
]
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"with open(\"aoc1_input.txt\", \"r\") as f:\n",
|
||||
" elves_raw = f.read().split(\"\\n\\n\")\n",
|
||||
" elves = map(lambda x: sum(map(int, x.split(\"\\n\"))), elves_raw)\n",
|
||||
" most_calories = max(elves)\n",
|
||||
"\n",
|
||||
"most_calories"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "4523a59c-06bb-4214-a9ce-143885257bb4",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"id": "614216a4-bbe9-40e9-a4b1-108e85946186",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"207410"
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"with open(\"aoc1_input.txt\", \"r\") as f:\n",
|
||||
" elves_raw = f.read().split(\"\\n\\n\")\n",
|
||||
" elves = map(lambda x: sum(map(int, x.split(\"\\n\"))), elves_raw)\n",
|
||||
" top_3_calories = sum(sorted(elves)[-3:])\n",
|
||||
"\n",
|
||||
"top_3_calories"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue