解答

  1. fn fib(n: u32) -> u32 {
  2. if n <= 2 {
  3. return 1;
  4. } else {
  5. return fib(n - 1) + fib(n - 2);
  6. }
  7. }
  8. fn main() {
  9. let n = 20;
  10. println!("fib({n}) = {}", fib(n));
  11. }