fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn main() { let n: i64 = read(); println!("{}", no44(n)); } fn no44(n: i64) -> i64 { use std::collections::HashMap; let mut cache = HashMap::new(); fn consumer(n: i64, cache: &mut HashMap) -> i64 { if let Some(ans) = cache.get(&n) { return *ans; } if n - 2 > 0 { let ans = consumer(n - 1, cache) + consumer(n - 2, cache); cache.entry(n).or_insert(ans); ans } else if n - 2 == 0 { 2 } else if n - 1 == 0 { 1 } else { 0 } } consumer(n, &mut cache) }