45 Star 130 Fork 53

Apocalypse / c2go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
11.go 337 Bytes
一键复制 编辑 原始数据 按行查看 历史
ZenQy 提交于 2015-03-29 18:12 . last push
//一只猴子摘了 N 个桃子第一天吃了一半又多吃了一个,第二天又吃了余下的
//一半又多吃了一个,到第十天的时候发现还有一个.
package main
import "fmt"
func main() {
fmt.Println("N =", peach(10))
}
func peach(n int) int {
if n == 1 {
return 1
} else {
return (peach(n-1) + 1) * 2
}
}
Go
1
https://gitee.com/justin.qin/c2go.git
git@gitee.com:justin.qin/c2go.git
justin.qin
c2go
c2go
master

搜索帮助