aboutsummaryrefslogtreecommitdiff
path: root/2016/src/day10.cpp
diff options
context:
space:
mode:
Diffstat (limited to '2016/src/day10.cpp')
-rw-r--r--2016/src/day10.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/2016/src/day10.cpp b/2016/src/day10.cpp
index 7c1f4f9..851ad9d 100644
--- a/2016/src/day10.cpp
+++ b/2016/src/day10.cpp
@@ -1,3 +1,4 @@
1#include <filesystem>
1#include <fstream> 2#include <fstream>
2#include <iostream> 3#include <iostream>
3#include <map> 4#include <map>
@@ -9,6 +10,8 @@ using namespace std;
9 10
10using Sink = tuple<string, int>; 11using Sink = tuple<string, int>;
11 12
13namespace {
14
12vector<string> 15vector<string>
13split(const string& line, char sep) 16split(const string& line, char sep)
14{ 17{
@@ -23,7 +26,7 @@ split(const string& line, char sep)
23} 26}
24 27
25map<int, tuple<Sink, Sink, vector<int>>> 28map<int, tuple<Sink, Sink, vector<int>>>
26read_file(string_view filename) 29read_file(const filesystem::path& filename)
27{ 30{
28 fstream input{ filename }; 31 fstream input{ filename };
29 32
@@ -84,16 +87,18 @@ solve(map<int, tuple<Sink, Sink, vector<int>>> bots)
84 87
85 // part1 88 // part1
86 if ( chips.at(0) == 17 && chips.at(1) == 61 ) { 89 if ( chips.at(0) == 17 && chips.at(1) == 61 ) {
87 cout << id << endl; 90 cout << id << '\n';
88 } 91 }
89 92
90 chips.clear(); 93 chips.clear();
91 } 94 }
92 95
93 // part2 96 // part2
94 cout << outputs[0] * outputs[1] * outputs[2] << endl; 97 cout << outputs[0] * outputs[1] * outputs[2] << '\n';
95} 98}
96 99
100} // namespace
101
97int 102int
98main() 103main()
99{ 104{