aboutsummaryrefslogtreecommitdiff
path: root/src/2015/day24/aoc.cpp
diff options
context:
space:
mode:
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};
}
+
}