diff --git a/Cargo.lock b/Cargo.lock index 6e23cf7..073b655 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,41 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "aoc-2022" version = "0.1.0" +dependencies = [ + "regex", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "regex" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" diff --git a/Cargo.toml b/Cargo.toml index a1cb824..44daa8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +regex = "1" \ No newline at end of file diff --git a/src/day01.rs b/src/day01.rs index ffb5d19..4b12700 100644 --- a/src/day01.rs +++ b/src/day01.rs @@ -3,7 +3,7 @@ use crate::utils; pub fn execute_task01(content: &str) { let vector = utils::convert_to_string_slice(&content); let mut sum_vector = collect_all_calories(vector); - sort_calories_descending(&mut sum_vector); + sum_vector.sort_by_key(|a| std::cmp::Reverse(*a)); let max: i32 = sum_vector[0]; @@ -13,7 +13,7 @@ pub fn execute_task01(content: &str) { pub fn execute_task02(content: &str) { let vector = utils::convert_to_string_slice(&content); let mut sum_vector = collect_all_calories(vector); - sort_calories_descending(&mut sum_vector); + sum_vector.sort_by_key(|a| std::cmp::Reverse(*a)); let max_three: i32 = sum_vector.iter().take(3).sum(); @@ -36,10 +36,4 @@ fn collect_all_calories(list: Vec<&str>) -> Vec { } return calories_list; -} - -fn sort_calories_descending(vec: &mut Vec) { - vec.sort_by_key(|a| - - std::cmp::Reverse(*a)); -} +} \ No newline at end of file diff --git a/src/day02.rs b/src/day02.rs index 781d8f3..df404d5 100644 --- a/src/day02.rs +++ b/src/day02.rs @@ -46,7 +46,6 @@ pub fn execute_task01(content: &str) { } - pub fn execute_task02(content: &str) { let vector = utils::convert_to_string_slice(&content); let score: i32 = vector.into_iter().map(|line| { @@ -62,21 +61,15 @@ pub fn execute_task02(content: &str) { } fn convert_to_conditional_move(opp: &Move, you: char) -> Move { - match you { - 'X' => match opp { // need to loose - Rock => Scissors, - Paper => Rock, - Scissors => Paper, - }, - 'Y' => - - opp.clone(), // need to draw - 'Z' => match opp { // need to win - Rock => Paper, - Paper => Scissors, - Scissors => Rock, - }, - _ => panic!("error"), + match (you, opp) { + ('X', Rock) => Scissors, + ('X', Paper) => Rock, + ('X', Scissors) => Paper, + ('Y', _) => opp.clone(), + ('Z', Rock) => Paper, + ('Z', Paper) => Scissors, + ('Z', Scissors) => Rock, + _ => unreachable!(), } } @@ -85,7 +78,7 @@ fn convert_to_move(c: char) -> Move { 'A' | 'X' => Rock, 'B' | 'Y' => Paper, 'C' | 'Z' => Scissors, - _ => panic!("error"), + _ => unreachable!(), } } diff --git a/src/day05.rs b/src/day05.rs new file mode 100644 index 0000000..ced7c76 --- /dev/null +++ b/src/day05.rs @@ -0,0 +1,126 @@ +extern crate regex; + +use std::collections::LinkedList; +use crate::utils; +use regex::Regex; + +pub fn execute_task01(content: &str) { + let re = Regex::new(r"move (\d+) from (\d+) to (\d+)").unwrap(); + + let mut setup: Vec<&str> = vec![]; + let mut setup_finish = false; + let mut port: Vec> = Default::default(); + let vector = utils::convert_to_string_slice(&content); + + vector.into_iter().for_each(|line| { + if line.trim().is_empty() { + setup_finish = true; + port = parse_port(setup.clone().to_vec()); + return; + } + + if !setup_finish { + setup.push(line); + return; + } + + let caps = re.captures(line).unwrap(); + let size: i32 = caps.get(1).map(|content| content.as_str().parse::()).unwrap().unwrap(); + let from: &str = caps.get(2).map(|content| content.as_str()).unwrap(); + let to: &str = caps.get(3).map(|content| content.as_str()).unwrap(); + + move_in_port(&mut port, from, to, size) + }); + + let str_line_vec: Vec = port.into_iter().map(|vec| vec.into_iter().last().unwrap().trim().replace("[", "").replace("]", "")).collect(); + + println!("Day05 - Task01 - Last Item Str Line: {}", str_line_vec.join("")); + +} + +pub fn execute_task02(content: &str) { + let re = Regex::new(r"move (\d+) from (\d+) to (\d+)").unwrap(); + + let mut setup: Vec<&str> = vec![]; + let mut setup_finish = false; + let mut port: Vec> = Default::default(); + let vector = utils::convert_to_string_slice(&content); + + vector.into_iter().for_each(|line| { + if line.trim().is_empty() { + setup_finish = true; + port = parse_port(setup.clone().to_vec()); + return; + } + + if !setup_finish { + setup.push(line); + return; + } + + let caps = re.captures(line).unwrap(); + let size: i32 = caps.get(1).map(|content| content.as_str().parse::()).unwrap().unwrap(); + let from: &str = caps.get(2).map(|content| content.as_str()).unwrap(); + let to: &str = caps.get(3).map(|content| content.as_str()).unwrap(); + + move_in_port_currently(&mut port, from, to, size) + }); + + let str_line_vec: Vec = port.into_iter().map(|vec| vec.into_iter().last().unwrap().trim().replace("[", "").replace("]", "")).collect(); + + println!("Day05 - Task02 - Last Item Str Line: {}", str_line_vec.join("")); + +} + +fn move_in_port(mut port: &mut Vec>, from: &str, to: &str, size: i32) { + for _ in 0..size { + move_in_port_once(&mut port, from, to) + } +} + +fn move_in_port_currently(port: &mut Vec>, from: &str, to: &str, size: i32) { + let mut tmp: LinkedList = LinkedList::new(); + for _ in 0..size { + let tmp_tmp = port.get_mut((from.parse::().unwrap()) -1).unwrap().pop_back().unwrap(); + tmp.push_front(tmp_tmp); + } + + port.get_mut((to.parse::().unwrap()) -1).unwrap().append(&mut tmp); +} + +fn move_in_port_once(port: &mut Vec>, from: &str, to: &str) { + let tmp: String = port.get_mut((from.parse::().unwrap()) -1).unwrap().pop_back().unwrap(); + port.get_mut((to.parse::().unwrap()) -1).unwrap().push_back(tmp); +} + +fn parse_port(lines: Vec<&str>) -> Vec> { + let mut port = vec![]; + + lines.into_iter() + .rev() + .skip(1) + .map(|line| parse_port_level(line)) + .for_each(|containers| { + for (i, item) in containers.into_iter().enumerate() { + if item.trim().is_empty() { + continue; + } + + if port.len() <= i { + port.insert(i, LinkedList::new()); + } + + port.get_mut(i).unwrap().push_back(item); + } + }); + + return port; +} + +fn parse_port_level(line: &str) -> Vec { + line.chars() + .collect::>() + .chunks(4) + .map(|c| c.iter().collect::()) + .collect() +} \ No newline at end of file diff --git a/src/input/day05/input01 b/src/input/day05/input01 new file mode 100644 index 0000000..dc1b483 --- /dev/null +++ b/src/input/day05/input01 @@ -0,0 +1,511 @@ + [W] [J] [J] + [V] [F] [F] [S] [S] + [S] [M] [R] [W] [M] [C] + [M] [G] [W] [S] [F] [G] [C] +[W] [P] [S] [M] [H] [N] [F] [L] +[R] [H] [T] [D] [L] [D] [D] [B] [W] +[T] [C] [L] [H] [Q] [J] [B] [T] [N] +[G] [G] [C] [J] [P] [P] [Z] [R] [H] + 1 2 3 4 5 6 7 8 9 + +move 3 from 4 to 3 +move 3 from 8 to 6 +move 2 from 3 to 8 +move 3 from 7 to 2 +move 1 from 1 to 3 +move 6 from 2 to 7 +move 5 from 3 to 6 +move 1 from 8 to 6 +move 4 from 4 to 3 +move 2 from 1 to 2 +move 10 from 7 to 3 +move 1 from 7 to 2 +move 6 from 5 to 8 +move 1 from 1 to 4 +move 7 from 6 to 3 +move 22 from 3 to 4 +move 3 from 2 to 8 +move 4 from 6 to 8 +move 5 from 2 to 1 +move 3 from 9 to 4 +move 2 from 4 to 3 +move 1 from 9 to 2 +move 1 from 5 to 3 +move 1 from 2 to 6 +move 1 from 5 to 2 +move 1 from 2 to 7 +move 4 from 4 to 5 +move 2 from 1 to 9 +move 1 from 1 to 3 +move 2 from 5 to 9 +move 5 from 9 to 8 +move 1 from 5 to 9 +move 1 from 7 to 2 +move 1 from 9 to 4 +move 5 from 6 to 7 +move 1 from 5 to 2 +move 2 from 2 to 4 +move 2 from 7 to 4 +move 2 from 7 to 8 +move 21 from 8 to 6 +move 6 from 3 to 1 +move 1 from 7 to 9 +move 1 from 1 to 7 +move 7 from 6 to 8 +move 3 from 1 to 9 +move 24 from 4 to 8 +move 3 from 1 to 3 +move 10 from 6 to 8 +move 1 from 4 to 5 +move 1 from 3 to 9 +move 5 from 9 to 8 +move 11 from 8 to 3 +move 1 from 5 to 7 +move 1 from 1 to 8 +move 1 from 6 to 1 +move 19 from 8 to 1 +move 1 from 7 to 9 +move 10 from 3 to 1 +move 3 from 3 to 8 +move 1 from 7 to 3 +move 1 from 9 to 2 +move 23 from 1 to 7 +move 1 from 1 to 9 +move 1 from 3 to 6 +move 2 from 6 to 9 +move 7 from 8 to 1 +move 8 from 8 to 1 +move 11 from 7 to 2 +move 2 from 6 to 8 +move 1 from 6 to 8 +move 7 from 8 to 6 +move 1 from 9 to 4 +move 1 from 8 to 1 +move 10 from 7 to 1 +move 6 from 2 to 5 +move 5 from 2 to 9 +move 4 from 5 to 8 +move 1 from 5 to 8 +move 13 from 1 to 6 +move 1 from 2 to 4 +move 1 from 4 to 5 +move 2 from 9 to 4 +move 3 from 9 to 4 +move 2 from 5 to 3 +move 1 from 3 to 9 +move 2 from 8 to 5 +move 2 from 5 to 7 +move 2 from 8 to 6 +move 2 from 7 to 3 +move 2 from 7 to 8 +move 4 from 1 to 3 +move 3 from 8 to 4 +move 8 from 4 to 9 +move 1 from 9 to 8 +move 3 from 3 to 6 +move 4 from 3 to 9 +move 1 from 8 to 2 +move 12 from 1 to 5 +move 9 from 6 to 8 +move 1 from 4 to 8 +move 3 from 1 to 3 +move 12 from 5 to 8 +move 1 from 2 to 6 +move 1 from 3 to 1 +move 1 from 3 to 2 +move 1 from 1 to 2 +move 16 from 6 to 1 +move 1 from 6 to 3 +move 2 from 3 to 8 +move 7 from 8 to 5 +move 1 from 2 to 6 +move 1 from 2 to 1 +move 2 from 9 to 4 +move 1 from 6 to 7 +move 8 from 9 to 8 +move 5 from 5 to 6 +move 9 from 8 to 7 +move 12 from 1 to 3 +move 2 from 6 to 3 +move 6 from 8 to 9 +move 5 from 1 to 4 +move 2 from 5 to 7 +move 11 from 7 to 3 +move 1 from 7 to 4 +move 2 from 6 to 8 +move 7 from 4 to 6 +move 3 from 8 to 7 +move 3 from 8 to 2 +move 19 from 3 to 2 +move 4 from 8 to 7 +move 2 from 9 to 8 +move 1 from 4 to 5 +move 1 from 6 to 8 +move 1 from 5 to 7 +move 8 from 9 to 4 +move 1 from 8 to 5 +move 1 from 5 to 6 +move 4 from 2 to 7 +move 8 from 6 to 9 +move 6 from 7 to 3 +move 4 from 3 to 8 +move 5 from 8 to 7 +move 15 from 2 to 8 +move 8 from 3 to 4 +move 7 from 9 to 7 +move 3 from 2 to 4 +move 2 from 7 to 4 +move 2 from 4 to 3 +move 1 from 9 to 4 +move 9 from 7 to 5 +move 4 from 5 to 9 +move 2 from 5 to 3 +move 2 from 9 to 1 +move 3 from 5 to 2 +move 4 from 3 to 1 +move 7 from 7 to 4 +move 3 from 2 to 6 +move 4 from 4 to 5 +move 2 from 1 to 6 +move 8 from 4 to 1 +move 1 from 8 to 2 +move 1 from 2 to 8 +move 11 from 8 to 7 +move 3 from 5 to 9 +move 1 from 5 to 9 +move 11 from 7 to 1 +move 7 from 8 to 9 +move 11 from 1 to 3 +move 6 from 4 to 5 +move 8 from 1 to 7 +move 4 from 6 to 5 +move 3 from 5 to 8 +move 8 from 7 to 3 +move 7 from 4 to 7 +move 7 from 5 to 6 +move 3 from 3 to 8 +move 2 from 4 to 9 +move 16 from 3 to 1 +move 7 from 7 to 1 +move 2 from 8 to 7 +move 2 from 8 to 1 +move 1 from 8 to 4 +move 1 from 7 to 4 +move 2 from 4 to 2 +move 1 from 8 to 7 +move 1 from 2 to 3 +move 1 from 2 to 4 +move 1 from 7 to 8 +move 8 from 6 to 7 +move 1 from 3 to 5 +move 15 from 1 to 2 +move 4 from 9 to 1 +move 1 from 8 to 1 +move 11 from 9 to 2 +move 21 from 2 to 6 +move 1 from 4 to 2 +move 4 from 2 to 7 +move 1 from 5 to 9 +move 1 from 9 to 4 +move 19 from 1 to 2 +move 5 from 2 to 4 +move 8 from 7 to 6 +move 10 from 6 to 2 +move 5 from 7 to 5 +move 2 from 4 to 1 +move 3 from 6 to 9 +move 3 from 9 to 2 +move 1 from 5 to 2 +move 13 from 6 to 3 +move 2 from 6 to 9 +move 17 from 2 to 3 +move 1 from 6 to 2 +move 2 from 2 to 1 +move 2 from 1 to 5 +move 5 from 5 to 3 +move 2 from 2 to 8 +move 10 from 2 to 1 +move 18 from 3 to 8 +move 13 from 8 to 1 +move 7 from 8 to 2 +move 2 from 2 to 1 +move 4 from 3 to 8 +move 1 from 2 to 7 +move 1 from 2 to 8 +move 2 from 4 to 1 +move 1 from 5 to 4 +move 1 from 9 to 6 +move 1 from 1 to 7 +move 11 from 3 to 4 +move 1 from 6 to 2 +move 7 from 1 to 2 +move 5 from 8 to 5 +move 1 from 7 to 5 +move 3 from 5 to 1 +move 7 from 1 to 6 +move 6 from 1 to 6 +move 6 from 1 to 8 +move 2 from 1 to 3 +move 5 from 2 to 5 +move 1 from 7 to 6 +move 1 from 4 to 2 +move 4 from 2 to 4 +move 1 from 1 to 9 +move 1 from 3 to 8 +move 7 from 8 to 5 +move 1 from 9 to 7 +move 1 from 9 to 4 +move 8 from 5 to 7 +move 5 from 4 to 1 +move 4 from 1 to 6 +move 3 from 1 to 6 +move 3 from 3 to 6 +move 1 from 5 to 6 +move 3 from 7 to 5 +move 15 from 6 to 7 +move 12 from 7 to 4 +move 8 from 5 to 2 +move 3 from 4 to 9 +move 3 from 9 to 7 +move 1 from 6 to 2 +move 9 from 4 to 9 +move 4 from 9 to 1 +move 2 from 1 to 7 +move 3 from 6 to 4 +move 3 from 6 to 4 +move 2 from 1 to 2 +move 1 from 5 to 6 +move 2 from 9 to 4 +move 13 from 4 to 2 +move 22 from 2 to 3 +move 3 from 7 to 8 +move 1 from 9 to 6 +move 1 from 9 to 3 +move 2 from 8 to 9 +move 3 from 9 to 8 +move 5 from 6 to 4 +move 2 from 8 to 6 +move 4 from 7 to 8 +move 2 from 2 to 5 +move 4 from 8 to 7 +move 2 from 5 to 7 +move 7 from 7 to 2 +move 9 from 4 to 7 +move 4 from 2 to 1 +move 3 from 7 to 6 +move 12 from 3 to 5 +move 5 from 2 to 5 +move 1 from 8 to 2 +move 1 from 3 to 5 +move 4 from 3 to 1 +move 2 from 6 to 1 +move 11 from 5 to 3 +move 3 from 6 to 1 +move 8 from 1 to 9 +move 5 from 9 to 8 +move 2 from 9 to 7 +move 1 from 1 to 8 +move 4 from 7 to 6 +move 6 from 3 to 1 +move 1 from 9 to 7 +move 5 from 7 to 4 +move 3 from 8 to 3 +move 1 from 6 to 5 +move 2 from 2 to 1 +move 4 from 7 to 9 +move 3 from 8 to 6 +move 6 from 3 to 8 +move 6 from 8 to 7 +move 4 from 6 to 5 +move 6 from 5 to 8 +move 2 from 9 to 5 +move 2 from 9 to 8 +move 4 from 7 to 4 +move 1 from 6 to 3 +move 5 from 8 to 4 +move 1 from 6 to 9 +move 1 from 7 to 3 +move 7 from 3 to 8 +move 6 from 1 to 4 +move 6 from 1 to 2 +move 17 from 4 to 6 +move 4 from 8 to 5 +move 3 from 3 to 1 +move 5 from 4 to 1 +move 5 from 2 to 7 +move 7 from 8 to 1 +move 7 from 7 to 2 +move 4 from 6 to 3 +move 6 from 1 to 8 +move 2 from 4 to 9 +move 2 from 5 to 4 +move 1 from 4 to 3 +move 1 from 4 to 7 +move 2 from 7 to 5 +move 4 from 5 to 3 +move 1 from 9 to 1 +move 5 from 5 to 3 +move 1 from 8 to 5 +move 7 from 6 to 1 +move 6 from 6 to 8 +move 11 from 3 to 7 +move 2 from 9 to 1 +move 8 from 8 to 2 +move 5 from 7 to 5 +move 5 from 7 to 4 +move 1 from 2 to 6 +move 2 from 4 to 6 +move 1 from 7 to 5 +move 2 from 6 to 4 +move 10 from 2 to 6 +move 3 from 4 to 5 +move 1 from 6 to 4 +move 4 from 6 to 4 +move 6 from 6 to 9 +move 3 from 3 to 8 +move 19 from 1 to 8 +move 23 from 8 to 9 +move 1 from 8 to 1 +move 1 from 1 to 7 +move 1 from 7 to 1 +move 1 from 1 to 6 +move 5 from 9 to 5 +move 1 from 8 to 5 +move 5 from 4 to 5 +move 4 from 5 to 4 +move 1 from 9 to 1 +move 6 from 9 to 3 +move 2 from 2 to 8 +move 1 from 1 to 3 +move 1 from 6 to 7 +move 1 from 7 to 3 +move 1 from 2 to 5 +move 6 from 9 to 8 +move 5 from 4 to 5 +move 10 from 5 to 2 +move 10 from 5 to 2 +move 11 from 9 to 1 +move 4 from 2 to 6 +move 18 from 2 to 9 +move 2 from 6 to 9 +move 3 from 3 to 9 +move 1 from 4 to 3 +move 1 from 6 to 8 +move 6 from 8 to 4 +move 6 from 5 to 7 +move 19 from 9 to 4 +move 7 from 1 to 3 +move 1 from 6 to 8 +move 4 from 8 to 7 +move 2 from 3 to 6 +move 3 from 1 to 8 +move 1 from 1 to 5 +move 7 from 7 to 3 +move 8 from 3 to 1 +move 1 from 5 to 7 +move 2 from 6 to 2 +move 3 from 1 to 8 +move 1 from 2 to 6 +move 3 from 1 to 7 +move 4 from 8 to 9 +move 4 from 7 to 6 +move 3 from 9 to 7 +move 3 from 9 to 3 +move 6 from 7 to 3 +move 13 from 3 to 1 +move 5 from 3 to 4 +move 1 from 8 to 7 +move 1 from 7 to 9 +move 1 from 8 to 5 +move 1 from 9 to 4 +move 1 from 5 to 2 +move 2 from 9 to 2 +move 3 from 6 to 2 +move 1 from 3 to 7 +move 13 from 4 to 8 +move 14 from 1 to 5 +move 6 from 2 to 7 +move 4 from 8 to 7 +move 1 from 1 to 3 +move 1 from 2 to 6 +move 5 from 4 to 2 +move 4 from 8 to 4 +move 12 from 5 to 4 +move 1 from 3 to 8 +move 9 from 4 to 2 +move 9 from 4 to 5 +move 1 from 4 to 5 +move 6 from 4 to 3 +move 5 from 8 to 4 +move 9 from 4 to 7 +move 4 from 2 to 3 +move 8 from 7 to 1 +move 2 from 7 to 1 +move 2 from 2 to 9 +move 1 from 6 to 7 +move 2 from 6 to 3 +move 1 from 2 to 3 +move 2 from 7 to 3 +move 3 from 3 to 7 +move 8 from 1 to 2 +move 9 from 5 to 3 +move 15 from 2 to 7 +move 20 from 7 to 5 +move 23 from 5 to 6 +move 20 from 6 to 8 +move 1 from 6 to 4 +move 2 from 9 to 7 +move 1 from 4 to 6 +move 3 from 7 to 6 +move 2 from 7 to 5 +move 13 from 3 to 5 +move 3 from 7 to 1 +move 13 from 5 to 4 +move 3 from 1 to 4 +move 5 from 6 to 1 +move 6 from 4 to 3 +move 1 from 7 to 4 +move 11 from 8 to 6 +move 1 from 8 to 6 +move 2 from 1 to 5 +move 2 from 5 to 3 +move 11 from 6 to 5 +move 3 from 8 to 3 +move 4 from 3 to 5 +move 15 from 5 to 1 +move 1 from 3 to 5 +move 3 from 8 to 5 +move 1 from 5 to 9 +move 1 from 5 to 3 +move 9 from 4 to 6 +move 7 from 6 to 8 +move 2 from 4 to 6 +move 2 from 5 to 1 +move 8 from 8 to 7 +move 6 from 6 to 2 +move 1 from 5 to 2 +move 4 from 3 to 4 +move 6 from 1 to 5 +move 7 from 3 to 4 +move 2 from 3 to 2 +move 2 from 8 to 9 +move 9 from 2 to 5 +move 9 from 5 to 4 +move 2 from 3 to 6 +move 14 from 1 to 7 +move 15 from 7 to 2 +move 1 from 1 to 7 +move 7 from 5 to 1 +move 2 from 9 to 2 +move 2 from 1 to 7 +move 1 from 1 to 4 +move 2 from 6 to 8 +move 7 from 2 to 8 +move 1 from 9 to 6 +move 7 from 8 to 3 +move 1 from 6 to 4 +move 1 from 8 to 2 +move 6 from 4 to 6 +move 9 from 2 to 1 +move 1 from 3 to 9 +move 3 from 7 to 5 \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 40d5d0a..8d6f015 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,11 +3,13 @@ mod day01; mod day02; mod day03; mod day04; +mod day05; const CONTENT01: &'static str = include_str!("input/day01/input01"); const CONTENT02: &'static str = include_str!("input/day02/input01"); const CONTENT03: &'static str = include_str!("input/day03/input01"); const CONTENT04: &'static str = include_str!("input/day04/input01"); +const CONTENT05: &'static str = include_str!("input/day05/input01"); fn main() { day01::execute_task01(&CONTENT01); @@ -20,5 +22,9 @@ fn main() { day03::execute_task02(&CONTENT03); day04::execute_task01(&CONTENT04); - day04::execute_task02(&CONTENT04) + day04::execute_task02(&CONTENT04); + + day05::execute_task01(&CONTENT05); + day05::execute_task02(&CONTENT05); + }