normalize

This commit is contained in:
Adam Jeniski 2025-12-13 19:46:03 -10:00
parent 42feac3994
commit 798e7ecd13

View File

@ -7,15 +7,13 @@
#include <string_view> #include <string_view>
#include <vector> #include <vector>
using Data = std::string; int64_t part_1(const std::vector<std::string> &);
int64_t part_2(const std::vector<std::string> &);
int64_t part_1(const std::vector<Data> &);
int64_t part_2(const std::vector<Data> &);
int main() { int main() {
std::ifstream file{"input/2025-3.txt"}; std::ifstream file{"input/2025-3.txt"};
Data line; std::string line;
std::vector<Data> v; std::vector<std::string> v;
while (std::getline(file, line)) { while (std::getline(file, line)) {
v.push_back(line); v.push_back(line);
} }
@ -42,7 +40,7 @@ int64_t solve(const std::string_view line, size_t cnt_to_activate) {
return std::stoll(std::string(&max_char) + std::to_string(recur)); return std::stoll(std::string(&max_char) + std::to_string(recur));
} }
int64_t part_1(const std::vector<Data> &v) { int64_t part_1(const std::vector<std::string> &v) {
int64_t ans{}; int64_t ans{};
for (auto d : v) { for (auto d : v) {
ans += solve(d, 2); ans += solve(d, 2);
@ -50,7 +48,7 @@ int64_t part_1(const std::vector<Data> &v) {
return ans; return ans;
} }
int64_t part_2(const std::vector<Data> &v) { int64_t part_2(const std::vector<std::string> &v) {
int64_t ans{}; int64_t ans{};
for (auto d : v) { for (auto d : v) {
ans += solve(d, 12); ans += solve(d, 12);