aboutsummaryrefslogtreecommitdiff
path: root/src/day14pt1.rs
diff options
context:
space:
mode:
authorAleksa Vuckovic <aleksa@vuckovic.cc>2023-12-15 03:57:07 +0100
committerAleksa Vuckovic <aleksa@vuckovic.cc>2023-12-15 04:31:46 +0100
commita06ae0bf475fda36bb1cbc5b0b7bbf355c499bed (patch)
tree8b0b04ee2097fbfe2f1d426081258ae0033200f4 /src/day14pt1.rs
parentb987ec6481ea40e257dc81a8b3ebfc5f0483afe5 (diff)
day13 & day14pt1
Diffstat (limited to 'src/day14pt1.rs')
-rw-r--r--src/day14pt1.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/day14pt1.rs b/src/day14pt1.rs
new file mode 100644
index 0000000..9b68f62
--- /dev/null
+++ b/src/day14pt1.rs
@@ -0,0 +1,23 @@
+pub fn main() {
+ let txt = std::fs::read_to_string("./input/day14.txt").unwrap();
+ let input = txt
+ .lines()
+ .map(|s| s.chars().collect::<Vec<char>>())
+ .collect::<Vec<Vec<char>>>();
+
+ let mut sum: u64 = 0;
+
+ for j in 0..input[0].len() {
+ let mut off: u64 = 0;
+ for i in 0..input.len() {
+ if input[i][j] == 'O' {
+ sum += input.len() as u64 - off;
+ off += 1;
+ } else if input[i][j] == '#' {
+ off = (i + 1) as u64;
+ }
+ }
+ }
+
+ println!("{}", sum);
+}