Compare commits
2 Commits
129447d88f
...
79ac732c39
| Author | SHA1 | Date | |
|---|---|---|---|
| 79ac732c39 | |||
| 2ce1b66855 |
@ -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);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ int main() {
|
|||||||
std::string line;
|
std::string line;
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
v.push_back(line);
|
v.emplace_back(line);
|
||||||
}
|
}
|
||||||
std::cout << "Part 1: " << part_1(v) << std::endl;
|
std::cout << "Part 1: " << part_1(v) << std::endl;
|
||||||
std::cout << "Part 2: " << part_2(v) << std::endl;
|
std::cout << "Part 2: " << part_2(v) << std::endl;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user