From 8d43e37df99f280377bed90284d6ac2428334804 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 30 Nov 2022 19:55:31 -0500 Subject: move 2021 days to folder; update README --- day6/consteval.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 day6/consteval.cpp (limited to 'day6/consteval.cpp') diff --git a/day6/consteval.cpp b/day6/consteval.cpp deleted file mode 100644 index f46da89..0000000 --- a/day6/consteval.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include - -consteval auto countFish(unsigned int day) -{ - unsigned char input[] = { - //3,4,3,1,2 -#include "in" - }; - - uint64_t counts[9]; - std::fill(counts, counts + 9, 0); - for (int i = 0; i < sizeof(input); ++i) - ++counts[input[i]]; - - for (int i = 0; i < day; ++i) { - std::rotate(counts, counts + 1, counts + 9); - counts[6] += counts[8]; - } - - return std::accumulate(counts, counts + 9, 0ull); -} - -int main() -{ - std::cout << "80: " << countFish(80) << std::endl; - std::cout << "256: " << countFish(256) << std::endl; - return 0; -} - -- cgit v1.2.3