From 03b991a5822842ab0cf6f63a0cd06d68fdd1f6ff Mon Sep 17 00:00:00 2001 From: David Vereb Date: Sun, 18 Dec 2022 23:34:18 -0500 Subject: [PATCH] Added day 10, but then the queue popped in FACEIT. --- 2022/10/Makefile | 2 + 2022/10/data.txt | 146 +++++++++++++++++++++++++++++++++++++++++++++++ 2022/10/main.cpp | 29 ++++++++++ 3 files changed, 177 insertions(+) create mode 100644 2022/10/Makefile create mode 100644 2022/10/data.txt create mode 100644 2022/10/main.cpp diff --git a/2022/10/Makefile b/2022/10/Makefile new file mode 100644 index 0000000..638e325 --- /dev/null +++ b/2022/10/Makefile @@ -0,0 +1,2 @@ +a.out: main.cpp + clang++ -std=c++2b -g -O0 main.cpp diff --git a/2022/10/data.txt b/2022/10/data.txt new file mode 100644 index 0000000..96dd8c2 --- /dev/null +++ b/2022/10/data.txt @@ -0,0 +1,146 @@ +addx 1 +addx 4 +noop +noop +noop +noop +addx 6 +addx -1 +noop +addx 5 +noop +addx 5 +noop +noop +noop +addx 1 +addx 3 +addx 1 +addx 6 +addx -1 +noop +noop +noop +addx 7 +noop +addx -39 +noop +noop +noop +addx 7 +addx 3 +addx -2 +addx 2 +noop +addx 3 +addx 2 +addx 5 +addx 2 +addx -8 +addx 13 +noop +addx 3 +addx -2 +addx 2 +addx 5 +addx -31 +addx 36 +addx -2 +addx -36 +noop +noop +noop +addx 3 +addx 5 +addx 2 +addx -7 +addx 15 +addx -5 +addx 5 +addx 2 +addx 1 +addx 4 +noop +addx 3 +noop +addx 2 +addx -13 +addx -16 +addx 2 +addx 35 +addx -40 +noop +noop +addx 7 +noop +noop +noop +addx 5 +noop +addx 5 +addx 10 +addx -10 +noop +noop +noop +addx 3 +noop +addx 16 +addx -9 +noop +noop +noop +addx 3 +noop +addx 7 +addx -32 +addx 35 +addx -38 +addx 22 +addx 10 +addx -29 +addx 2 +noop +addx 3 +addx 5 +addx 2 +addx 2 +addx -12 +addx 13 +noop +noop +addx 7 +addx 5 +noop +noop +noop +addx 7 +addx -6 +addx 2 +addx 5 +addx -38 +addx 1 +noop +noop +addx 2 +noop +addx 3 +addx 5 +noop +addx 4 +addx -2 +addx 5 +addx 2 +addx 1 +noop +addx 4 +addx 4 +addx -14 +addx 16 +noop +addx -13 +addx 18 +addx -1 +noop +noop +noop diff --git a/2022/10/main.cpp b/2022/10/main.cpp new file mode 100644 index 0000000..a43dc5e --- /dev/null +++ b/2022/10/main.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +#include +#include + +int main() +{ + std::ifstream ifs("data.txt"); + if(!ifs.is_open()) + { + std::cerr << "Missing data.txt." << std::endl; + return -1; + } + + unsigned long total = 0; + unsigned long total_pt2 = 0; + + for(std::string line; std::getline(ifs, line); ) + { + if(line == "") + continue; + } + + std::cout << " Total: " << total << std::endl; + std::cout << "PT2 Total: " << total_pt2 << std::endl; + + return 0; +}