diff options
author | kaiwu <kaiwu2004@gmail.com> | 2022-12-11 17:41:18 +0800 |
---|---|---|
committer | kaiwu <kaiwu2004@gmail.com> | 2022-12-11 17:41:18 +0800 |
commit | 1c3c2e3f8a72b7e2968f3583e8582333457e583a (patch) | |
tree | 46459a29d6e9db20e076d62c3a223000e7e7cb7b /src/2015/day24/aoc.cpp | |
parent | 76dbb441216d24856594d930e0d2140a07231e8a (diff) | |
download | advent-of-code-1c3c2e3f8a72b7e2968f3583e8582333457e583a.tar.gz advent-of-code-1c3c2e3f8a72b7e2968f3583e8582333457e583a.zip |
2022 day11
Diffstat (limited to 'src/2015/day24/aoc.cpp')
-rw-r--r-- | src/2015/day24/aoc.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/2015/day24/aoc.cpp b/src/2015/day24/aoc.cpp index 8115c87..81baeb8 100644 --- a/src/2015/day24/aoc.cpp +++ b/src/2015/day24/aoc.cpp @@ -3,7 +3,23 @@ namespace aoc2015 { +int get_number(const char* p) { + int d{0}; + while(*p >= '0' && *p <= '9') { + d = d * 10 + *p - '0'; + p++; + } + return d; +} + std::pair<int, int> day24(line_view file) { - return {0, 0}; + int total{0}; + per_line(file,[&total](line_view lv){ + total += get_number(lv.line); + return true; + }); + int sub = total / 3; + return {total, 0}; } + } |