aboutsummaryrefslogtreecommitdiff
path: root/day06
diff options
context:
space:
mode:
authorjacopograndi <jacopo.grandi@outlook.it>2022-01-06 18:44:53 +0100
committerjacopograndi <jacopo.grandi@outlook.it>2022-01-06 18:44:53 +0100
commit6f96b2014b053a2e6e5a37464ca6fc578607fda7 (patch)
treecdb4686352eeadb2225b984ab56819c7de285af4 /day06
parent9f7b0cd76272068588d0a7220408f91390c5b583 (diff)
rm
Diffstat (limited to 'day06')
-rwxr-xr-xday06/day06bin76512 -> 0 bytes
-rw-r--r--day06/day06.cpp47
-rw-r--r--day06/day06_input.txt1
-rw-r--r--day06/day06_input_ez.txt1
-rw-r--r--day06/makefile2
5 files changed, 0 insertions, 51 deletions
diff --git a/day06/day06 b/day06/day06
deleted file mode 100755
index ccf553a..0000000
--- a/day06/day06
+++ /dev/null
Binary files differ
diff --git a/day06/day06.cpp b/day06/day06.cpp
deleted file mode 100644
index 38d602b..0000000
--- a/day06/day06.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <iostream>
-#include <fstream>
-#include <string>
-#include <vector>
-
-#include "../utils.h"
-
-long sum (std::vector<long> vec) {
- long s = 0; for (long v : vec) s += v; return s;
-}
-
-int main (int argc, char *argv[]) {
- std::string raw;
- std::getline(std::ifstream(argv[1]), raw, '\0');
- std::vector<std::string> strfish;
- split(strfish, raw, ",");
-
- std::vector<long> fish;
- for (int i=0; i<9; i++) { fish.push_back(0); }
- for (std::string str : strfish) fish[std::stoi(str)] += 1;
-
- int days = 80;
- if (argc > 2) days = std::stoi(std::string(argv[2]));
- for (int i=0; i<days; i++) {
- long born = fish[0];
- fish[0] = 0;
- for (int j=1; j<9; j++) {
- fish[j-1] += fish[j];
- fish[j] = 0;
- }
- fish[6] += born;
- fish[8] = born;
-
- if (argc > 3 && std::string(argv[3]) == "-w") {
- std::cout << "day " << i+1 << "/" << days
- << " current fish: " << sum(fish) << std::endl;
- }
- if (argc > 3 && std::string(argv[3]) == "-v") {
- std::cout << "day " << i+1 << ": ";
- for (auto f : fish) std::cout << f << ",";
- std::cout << std::endl;
- }
- }
-
- std::cout << "fish: " << sum(fish) << std::endl;
- return 0;
-}
diff --git a/day06/day06_input.txt b/day06/day06_input.txt
deleted file mode 100644
index 5b38bce..0000000
--- a/day06/day06_input.txt
+++ /dev/null
@@ -1 +0,0 @@
-4,1,1,4,1,1,1,1,1,1,1,1,3,4,1,1,1,3,1,3,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,5,1,2,1,1,5,3,4,2,1,1,4,1,1,5,1,1,5,5,1,1,5,2,1,4,1,2,1,4,5,4,1,1,1,1,3,1,1,1,4,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,2,1,1,1,1,1,1,1,2,4,4,1,1,3,1,3,2,4,3,1,1,1,1,1,2,1,1,1,1,2,5,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,4,1,5,1,3,1,1,1,1,1,5,1,1,1,3,1,2,1,2,1,3,4,5,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,3,1,1,3,1,1,4,1,1,1,1,1,2,1,1,1,1,3,2,1,1,1,4,2,1,1,1,4,1,1,2,3,1,4,1,5,1,1,1,2,1,5,3,3,3,1,5,3,1,1,1,1,1,1,1,1,4,5,3,1,1,5,1,1,1,4,1,1,5,1,2,3,4,2,1,5,2,1,2,5,1,1,1,1,4,1,2,1,1,1,2,5,1,1,5,1,1,1,3,2,4,1,3,1,1,2,1,5,1,3,4,4,2,2,1,1,1,1,5,1,5,2
diff --git a/day06/day06_input_ez.txt b/day06/day06_input_ez.txt
deleted file mode 100644
index 55129f1..0000000
--- a/day06/day06_input_ez.txt
+++ /dev/null
@@ -1 +0,0 @@
-3,4,3,1,2
diff --git a/day06/makefile b/day06/makefile
deleted file mode 100644
index 2bc132f..0000000
--- a/day06/makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-all day06.cpp:
- g++ -std=c++20 -o day06 day06.cpp