summaryrefslogtreecommitdiffstats
path: root/2015/rs/src/two.rs
diff options
context:
space:
mode:
Diffstat (limited to '2015/rs/src/two.rs')
-rw-r--r--2015/rs/src/two.rs31
1 files changed, 0 insertions, 31 deletions
diff --git a/2015/rs/src/two.rs b/2015/rs/src/two.rs
deleted file mode 100644
index 572c556..0000000
--- a/2015/rs/src/two.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-static INPUT: &'static str = include_str!("two.txt");
-
-fn main() {
- let valueified = INPUT
- .split('\n')
- .filter(|s| !s.is_empty())
- .map(|line| {
- let mut nums = line
- .split('x')
- .map(str::parse::<u32>)
- .map(Result::unwrap);
- (nums.next().unwrap(), nums.next().unwrap(), nums.next().unwrap())
- });
-
- let final_area: u32 = valueified.clone()
- .map(|(w, l, h)| {
- let sides = [w*h, l*w, h*l];
- sides.into_iter().min().unwrap() + sides.into_iter().sum::<u32>() * 2
- })
- .sum();
- println!("Final area: {final_area}");
-
- let ribbon_length: u32 = valueified
- .map(|(w, l, h)| {
- let mut nums = [w, l, h];
- nums.sort();
- (nums[0] + nums[1]) * 2 + (w * l * h)
- })
- .sum();
- println!("Ribbon length: {ribbon_length}");
-}