a.rs (361B)
1 mod common; 2 use common::*; 3 4 fn apply_move(grid: &mut Vec::<Vec::<char>>, line: &str) { 5 let (n, from, to) = read_move(&line); 6 7 for _ in 0..n { 8 let x = grid[from-1].pop().unwrap(); 9 grid[to-1].push(x); 10 } 11 } 12 13 fn main() { 14 let mut grid = get_grid_from_stdin(); 15 apply_moves_from_stdin(&mut grid, apply_move); 16 print_top(&grid); 17 }