Skip to content

Instantly share code, notes, and snippets.

@alucky0707
Created June 23, 2014 14:26
Show Gist options
  • Save alucky0707/b9e4b70a4c84fd6bebe9 to your computer and use it in GitHub Desktop.
Save alucky0707/b9e4b70a4c84fd6bebe9 to your computer and use it in GitHub Desktop.
フィボナッチこころぴょんぴょんmagic! ref: http://qiita.com/alucky0707/items/cb5362a0c9fb4f6dfbbd
$ go run kokoropyonpyon.go
こころぴょんぴょんぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょんこころぴょんぴょんぴょんぴょんこころぴょんぴょん
package main
import "fmt"
func KokoroPyonpyon(n int) string {
if n < 0 {
panic("そんなのないよ。ありえない!")
}
switch n {
case 0:
return "こころ"
case 1:
return "ぴょんぴょん"
default:
return KokoroPyonpyon(n - 2) + KokoroPyonpyon(n - 1)
}
}
func main() {
fmt.Println(KokoroPyonpyon(30))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment