Files
AdventOfCode2025/Day1/Question1/main.cpp
2025-12-01 23:57:59 +02:00

19 lines
469 B
C++

#include <cstdint>
#include <fstream>
#include <iostream>
#include <string>
int main() {
std::fstream inputFile("input");
std::string currentLine;
int16_t counter = 50, number = 0, password = 0;
while (std::getline(inputFile, currentLine)) {
number = std::stoi(currentLine.substr(1));
counter = (counter + ((currentLine[0] == 'L') * 2 - 1) * number) % 100;
password += counter == 0 ? 1 : 0;
}
std::cout << password << std::endl;
return 0;
}