Day 3 - fmt and change I/O error msg
This commit is contained in:
parent
d032c76265
commit
ce0d539617
1 changed files with 7 additions and 8 deletions
|
@ -5,7 +5,7 @@ use std::fs;
|
||||||
pub fn d03() {
|
pub fn d03() {
|
||||||
let path = "res/03/input.txt";
|
let path = "res/03/input.txt";
|
||||||
|
|
||||||
let contents = fs::read_to_string(path).expect("Should have been able to read the file");
|
let contents = fs::read_to_string(path).expect("I/O error, wrong path?");
|
||||||
|
|
||||||
let cont_arr = contents.split("\n");
|
let cont_arr = contents.split("\n");
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ pub fn d03() {
|
||||||
|
|
||||||
println!("Result 1: {}", result);
|
println!("Result 1: {}", result);
|
||||||
|
|
||||||
|
|
||||||
// 2nd task
|
// 2nd task
|
||||||
// calculate results - find duplicates in each 3-rucksack groups and sum up
|
// calculate results - find duplicates in each 3-rucksack groups and sum up
|
||||||
let mut result = 0;
|
let mut result = 0;
|
||||||
|
@ -53,7 +52,7 @@ pub fn d03() {
|
||||||
result += first_triplicate_value(
|
result += first_triplicate_value(
|
||||||
&rucksacks[i * 3],
|
&rucksacks[i * 3],
|
||||||
&rucksacks[i * 3 + 1],
|
&rucksacks[i * 3 + 1],
|
||||||
&rucksacks[i*3 + 2]
|
&rucksacks[i * 3 + 2],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue