aboutsummaryrefslogtreecommitdiff
path: root/src/2015/day24/aoc.cpp
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2022-12-11 17:41:18 +0800
committerkaiwu <kaiwu2004@gmail.com>2022-12-11 17:41:18 +0800
commit1c3c2e3f8a72b7e2968f3583e8582333457e583a (patch)
tree46459a29d6e9db20e076d62c3a223000e7e7cb7b /src/2015/day24/aoc.cpp
parent76dbb441216d24856594d930e0d2140a07231e8a (diff)
downloadadvent-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.cpp18
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};
}
+
}