diff options
| -rw-r--r-- | .editorconfig | 2 | ||||
| -rw-r--r-- | day01/solution.cpp | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/.editorconfig b/.editorconfig index 3e36df7..a1857f9 100644 --- a/.editorconfig +++ b/.editorconfig | |||
| @@ -6,7 +6,7 @@ insert_final_newline = true | |||
| 6 | charset = utf-8 | 6 | charset = utf-8 |
| 7 | trim_trailing_whitespace = true | 7 | trim_trailing_whitespace = true |
| 8 | indent_style = space | 8 | indent_style = space |
| 9 | indent_size = 2 | 9 | indent_size = 4 |
| 10 | max_line_length = 80 | 10 | max_line_length = 80 |
| 11 | 11 | ||
| 12 | [*.md] | 12 | [*.md] |
diff --git a/day01/solution.cpp b/day01/solution.cpp index 9fb9ec1..33b7550 100644 --- a/day01/solution.cpp +++ b/day01/solution.cpp | |||
| @@ -13,9 +13,7 @@ auto parse_input(std::istream& is) { | |||
| 13 | std::vector<int> document; | 13 | std::vector<int> document; |
| 14 | for (auto const line : lines) { | 14 | for (auto const line : lines) { |
| 15 | char direction = line[0]; | 15 | char direction = line[0]; |
| 16 | std::string out; | 16 | int length = std::stoi(std::ranges::to<std::string>(line | views::drop(1))); |
| 17 | ranges::copy(line | views::drop(1), std::back_inserter(out)); | ||
| 18 | int length = std::stoi(out); | ||
| 19 | document.push_back(direction == 'R' ? length : -length); | 17 | document.push_back(direction == 'R' ? length : -length); |
| 20 | } | 18 | } |
| 21 | return document; | 19 | return document; |
| @@ -54,7 +52,6 @@ void part2(auto const& input) { | |||
| 54 | } | 52 | } |
| 55 | dial %= DIAL_MAX; | 53 | dial %= DIAL_MAX; |
| 56 | old_dial = dial; | 54 | old_dial = dial; |
| 57 | std::cerr << answer << ' ' << dial << '\n'; | ||
| 58 | } | 55 | } |
| 59 | std::println("{}", answer); | 56 | std::println("{}", answer); |
| 60 | } | 57 | } |
