This commit is contained in:
Adam Jeniski 2025-12-13 19:49:40 -10:00
parent 2ce1b66855
commit 79ac732c39

View File

@ -19,7 +19,7 @@ int main() {
char throwaway; char throwaway;
std::vector<Data> v; std::vector<Data> v;
while (file >> line.min >> throwaway >> line.max) { while (file >> line.min >> throwaway >> line.max) {
v.push_back(line); v.emplace_back(line);
file >> throwaway; file >> throwaway;
} }
std::cout << "Part 1: " << part_1(v) << std::endl; std::cout << "Part 1: " << part_1(v) << std::endl;
@ -67,7 +67,7 @@ int64_t part_2(const std::vector<Data> &v) {
} }
} }
// todo: dead code, delete me // todo: dead code, delete me, then inline solve_n
int64_t foobar = std::accumulate(v.begin(), v.end(), 0, [&ans](int64_t acc, Data d) { int64_t foobar = std::accumulate(v.begin(), v.end(), 0, [&ans](int64_t acc, Data d) {
for (auto n{d.min}; n <= d.max; ++n) { for (auto n{d.min}; n <= d.max; ++n) {
acc += solve_n(n); acc += solve_n(n);