#pragma once #include "common.h" #include namespace aoc2017 { struct component { int pins[2] = {0}; void get_number(const char** pp, int* d) { const char* p = *pp; while (*p >= '0' && *p <= '9') { *d = *d * 10 + *p - '0'; p++; } *pp = p; } void print() const noexcept { printf("%d/%d\n", pins[0], pins[1]); } component(line_view lv) { int i{0}; const char* p = lv.line; while (p < lv.line + lv.length) { if (*p >= '0' && *p <= '9') { get_number(&p, &pins[i++]); } p++; } } }; std::pair day24(line_view); } // namespace aoc2017