Module b

Expand description

ยงABC 396 B - Card Pile

refs: https://atcoder.jp/contests/abc396/tasks/abc396_b

use proconio::input;

fn main() {
    input! {
        q: usize,
    }

    let mut stack = vec![0; 100];

    for _ in 0..q {
        input! { t: usize }

        match t {
            1 => {
                input! {x: usize}
                stack.push(x);
            }
            2 => {
                println!("{}", stack.pop().expect("Invalid Input"));
            }
            _ => panic!("Invalid Input"),
        }
    }
}