Created
March 13, 2017 07:44
-
-
Save v1c77/1746742703247aa3ace2b5bf61575dc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"golang.org/x/tour/pic" | |
"math" | |
) | |
//实现 Pic 。它应当返回一个长度为 dy 的切片,其中每个元素是一个长度为 dx ,元素类型为 uint8 的切片 | |
func Pic(dx, dy int) [][]uint8 { | |
myret := make([][]uint8, dy) | |
for i := 0; i < dy ; i++{ | |
myret[i] = make([]uint8, dx) | |
for j := 0; j < dx ; j++ { | |
myret[i][j] = uint8(float64(j) * math.Log(float64(i))) | |
} | |
} | |
return myret | |
} | |
func main() { | |
pic.Show(Pic) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment