This commit is contained in:
2026-05-29 13:11:46 +08:00
commit b474274349
2 changed files with 17 additions and 0 deletions
@@ -0,0 +1 @@
{"name":"Local: 1","url":"/home/wonder/code/algrithm/LC1/1.go","tests":[{"id":1780031224656,"input":"5","output":"8"}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"/home/wonder/code/algrithm/LC1/1.go","group":"local","local":true}
+16
View File
@@ -0,0 +1,16 @@
package main
import "fmt"
func dfs(i int) int {
if i <= 2 {
return i
}
return dfs(i-1) + dfs(i-2)
}
func main() {
var n int
fmt.Scan(&n)
fmt.Println(dfs(n))
}