Skip to content

Commit e75d795

Browse files
committed
Tidy up
1 parent ed80785 commit e75d795

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/y2025/day1.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,15 @@ fn count_zeros(turns: &[Turn], all: bool) -> i32 {
3838
if all {
3939
match (started_at_zero, pos) {
4040
(true, ..0) => count += -q,
41-
(true, 100..) => count += q,
4241
(false, ..=0) => count += -q + 1,
43-
(false, 100..) => count += q,
42+
(_, 100..) => count += q,
4443
(_, _) => {}
4544
}
4645
} else if pos % 100 == 0 {
4746
count += 1;
4847
}
4948

50-
pos %= 100;
51-
if pos < 0 {
52-
pos += 100;
53-
}
49+
pos = pos.rem_euclid(100);
5450
}
5551
count
5652
}

0 commit comments

Comments
 (0)