From 6f96b2014b053a2e6e5a37464ca6fc578607fda7 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Thu, 6 Jan 2022 18:44:53 +0100 Subject: rm --- day07/day07 | Bin 76312 -> 0 bytes day07/day07.cpp | 40 ---------------------------------------- day07/day07_input.txt | 1 - day07/day07_input_ez.txt | 1 - day07/makefile | 2 -- 5 files changed, 44 deletions(-) delete mode 100755 day07/day07 delete mode 100644 day07/day07.cpp delete mode 100644 day07/day07_input.txt delete mode 100644 day07/day07_input_ez.txt delete mode 100644 day07/makefile (limited to 'day07') diff --git a/day07/day07 b/day07/day07 deleted file mode 100755 index 4cbc735..0000000 Binary files a/day07/day07 and /dev/null differ diff --git a/day07/day07.cpp b/day07/day07.cpp deleted file mode 100644 index f9bbd1a..0000000 --- a/day07/day07.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include -#include - -#include "../utils.h" - -long sumdist (std::vector pos, int pole, int inc) { - long sd = 0; - for (auto p : pos) { - int n = abs(p-pole); - if (inc == 1) n = (n * (n+1)) / 2; - sd += n; - } - return sd; -} - -int main (int argc, char *argv[]) { - std::string raw; - std::getline(std::ifstream(argv[1]), raw, '\0'); - std::vector vec; - split(vec, raw, ","); - std::vector pos; - for (auto s : vec) pos.push_back(std::stoi(s)); - - int minp = 10000, maxp = -10000; - for (auto p : pos) { - minp = std::min(minp, p); - maxp = std::max(maxp, p); - } - int inc = argc > 2 ? atoi(argv[2]) : 0; - long fuel = 100000000000; - for (int i=minp; i