-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.rs
More file actions
18 lines (17 loc) · 512 Bytes
/
main.rs
File metadata and controls
18 lines (17 loc) · 512 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub fn main() {
let map: Vec<&[u8]> = include_str!("../input.txt")
.lines()
.map(|l| l.as_bytes())
.collect();
println!(
"{}",
(0..5)
.map(|i| ((1 + i * 2) % 8, 1 + i / 4))
.map(|(xx, yy)| (0..)
.map(|i| ((i + 1) * xx, (i + 1) * yy))
.take_while(|(_, y)| y < &map.len())
.filter(|(x, y)| map[*y][*x % map[0].len()] == b'#')
.count())
.product::<usize>()
);
}