题解 | #跳台阶# | Golang
跳台阶
https://www.nowcoder.com/practice/bfb2a2b3cdbd4bd6bba0d4dca69aa3f0
package main import ( "fmt" ) func countWay(n int) int { if n ==1 { return 1 } if n == 2 { return 2 } return countWay(n-1) + countWay(n-2) } func main() { n := 0 fmt.Scan(&n) fmt.Print(countWay(n)) }