Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const _INPUT: &str = "3,4,1,5";
- const INPUT: &str = "63,144,180,149,1,255,167,84,125,65,188,0,2,254,229,24";
- const SIZE: usize = 256;
- fn main() {
- let mut circle: Vec<usize> = (0..SIZE).collect();
- let mut pos = 0;
- let mut skip_size = 0;
- for length in INPUT.split(',').map(|n| n.parse::<usize>().unwrap()) {
- for i in 0..length / 2 {
- circle.swap((pos + i) % SIZE, (pos + length - 1 - i) % SIZE);
- }
- pos += length + skip_size;
- skip_size += 1;
- }
- println!("{}", circle[0] * circle[1]);
- }
Add Comment
Please, Sign In to add comment