2021 - Day 1

This commit is contained in:
2021-12-01 23:38:24 +01:00
commit 4410cef1c4
7 changed files with 4056 additions and 0 deletions

2000
2021/1/1/input Normal file

File diff suppressed because it is too large Load Diff

23
2021/1/1/main.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include <iostream>
#include <fstream>
int main() {
std::fstream input("1/input", std::ios::in);
std::string line;
std::getline(input, line);
int prev = std::stoi(line);
int increases = 0;
while (std::getline(input, line)) {
int next = std::stoi(line);
if (next > prev) {
increases++;
}
prev = next;
}
std::cout << "Increases: " << increases << '\n';
}