--- Day 1: Counting Calories ---

December 1

Listening to: My friends in VRChat


Okay, new year, and I prepared a little bit. I set up my website a bunch, made it so multiple years are on semi-seprate pages (thought I want to fix that still). But I have my new repo set up and running properly, so when it starts in about 30 minutes, I should be fine! I'm excited, and I'm chatting with friends in VR chat


Okay that was super simple. I just needed to use getline(input, line); instead of the simpler input >> line in order for the system not to throw out blank lines, since that matters, Otherwise, the logic was super simple.

int mostCalories = 0, curCalories = 0;
while (!input.eof())
{
    getline(input, line);
    if (line == "") {
        if (curCalories > mostCalories) {
            mostCalories = curCalories;
        }
        curCalories = 0;
    } else {
        curCalories += stoi(line);
    }
}

Onto the next part!


Okay, easy. Put all the calorie counts in a vector, sort, and take the top three.

Only thing that threw me off was the sort was backwards from expected. But I got it!

sort(calorieCount.begin(), calorieCount.end(), std::greater<>());

Also, as a side note, it's really hard to concentrate when you have a lot of people talking in your ear via VRChat. I'm not doing this again.


Time taken: 20 minutes

My solutions for today's puzzles