1 Star 0 Fork 52

Palmworld/c2go

forked from Apocalypse/c2go 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
11.go 337 Bytes
Copy Edit Raw Blame History
ZenQy authored 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
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/imwinjune/c2go.git
git@gitee.com:imwinjune/c2go.git
imwinjune
c2go
c2go
master

Search

0d507c66 1850385 C8b1a773 1850385