diff options
Diffstat (limited to 'day6/consteval.cpp')
-rw-r--r-- | day6/consteval.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
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 <algorithm> -#include <cstdint> -#include <numeric> -#include <iostream> - -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; -} - |