We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ed80785 commit e75d795Copy full SHA for e75d795
1 file changed
src/y2025/day1.rs
@@ -38,19 +38,15 @@ fn count_zeros(turns: &[Turn], all: bool) -> i32 {
38
if all {
39
match (started_at_zero, pos) {
40
(true, ..0) => count += -q,
41
- (true, 100..) => count += q,
42
(false, ..=0) => count += -q + 1,
43
- (false, 100..) => count += q,
+ (_, 100..) => count += q,
44
(_, _) => {}
45
}
46
} else if pos % 100 == 0 {
47
count += 1;
48
49
50
- pos %= 100;
51
- if pos < 0 {
52
- pos += 100;
53
- }
+ pos = pos.rem_euclid(100);
54
55
count
56
0 commit comments