暂无

暂无

暂无

暂无

## 最近的评论

• 关闭360,解决了问题，感谢层主
• 评论了博文 golang99道练习题之02
###我的一个想法 func calcu(x float32) (float32) { var rs float32 //定义结构体 type Arrs struct { price int rule float32 } test := []Arrs{ {10,x * 0.10}, {20,10 * 0.1 + (x - 10) * 0.075}, {40,10 * 0.1 + 10 * 0.075 + (x-20) * 5/100}, {60,10 * 10/100 + 10 * 7.5/100 + 20 * 5/100 + (x-40) * 3/100}, {100,10 * 10/100 + 10 * 7.5/100 + 20 * 5/100 + 20 * 3/100 + (x - 60) * 1.5/100}, {1000000,10 * 10/100 + 10 * 7.5/100 + 20 * 5/100 + 20 * 3/100 + 40 * 1.5/100 + (x-100) * 1/100}, } for _,v := range test { if x <= float32(v.price) { //fmt.Print(x,v.price,v.rule) rs = v.rule break } } return rs }
• 评论了博文 golang99道练习题之02
func calcu(x float32) (float32) { var rs float32 //定义结构体 type Arrs struct { price int rule float32 } test := []Arrs{ {10,x * 0.10}, {20,10 * 0.1 + (x - 10) * 0.075}, {40,10 * 0.1 + 10 * 0.075 + (x-20) * 5/100}, {60,10 * 10/100 + 10 * 7.5/100 + 20 * 5/100 + (x-40) * 3/100}, {100,10 * 10/100 + 10 * 7.5/100 + 20 * 5/100 + 20 * 3/100 + (x - 60) * 1.5/100}, {1000000,10 * 10/100 + 10 * 7.5/100 + 20 * 5/100 + 20 * 3/100 + 40 * 1.5/100 + (x-100) * 1/100}, } for _,v := range test { if x <= float32(v.price) { //fmt.Print(x,v.price,v.rule) rs = v.rule break } } return rs }