From fa26f694d8cf98272763952a698301ee9935c19e Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 26 Jun 2025 09:47:23 +0200 Subject: Added 2022, first few problems --- 2022/05/a.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 2022/05/a.rs (limited to '2022/05/a.rs') diff --git a/2022/05/a.rs b/2022/05/a.rs new file mode 100644 index 0000000..ae0e937 --- /dev/null +++ b/2022/05/a.rs @@ -0,0 +1,17 @@ +mod common; +use common::*; + +fn apply_move(grid: &mut Vec::>, line: &str) { + let (n, from, to) = read_move(&line); + + for _ in 0..n { + let x = grid[from-1].pop().unwrap(); + grid[to-1].push(x); + } +} + +fn main() { + let mut grid = get_grid_from_stdin(); + apply_moves_from_stdin(&mut grid, apply_move); + print_top(&grid); +} -- cgit v1.3