aocpp/2017/10.cpp

27 lines
636 B
C++
Raw Normal View History

2022-11-24 12:10:08 -08:00
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <doctest.h>
#include <aocpp/Startup.hpp>
#include <aocpp/Parsing.hpp>
#include <knothash.hpp>
2023-01-31 08:58:42 -08:00
auto Main(std::istream & in) -> void
{
2022-11-24 12:10:08 -08:00
std::string line;
2023-01-31 08:58:42 -08:00
std::getline(in, line);
2022-11-24 12:10:08 -08:00
std::vector<std::uint8_t> lengths1;
for (auto && x : aocpp::SplitOn(line, ",")) {
lengths1.push_back(std::stoul(x));
}
auto result = knothash::hash_ex<256>(1, lengths1.begin(), lengths1.end());
std::cout << "Part 1: " << long{result[0]} * long{result[1]} << std::endl;
std::cout << "Part 2: " << knothash::render(knothash::hash(line)) << std::endl;
2023-01-31 08:58:42 -08:00
}