fg
This commit is contained in:
parent
2e763f0dd6
commit
410010a974
|
|
@ -2,19 +2,19 @@ package main
|
|||
|
||||
import "fmt"
|
||||
|
||||
type Point struct {
|
||||
x int
|
||||
func Cakes(recipe, available map[string]int) int {
|
||||
fin := 100000
|
||||
for k := range recipe {
|
||||
fmt.Printf("recipe[k] is %d and available[k] is %d\n", recipe[k], available[k])
|
||||
temp := available[k] / recipe[k]
|
||||
if temp < fin {
|
||||
fin = temp
|
||||
}
|
||||
|
||||
func (p *Point) Inc() {
|
||||
p.x++
|
||||
}
|
||||
fmt.Println(fin)
|
||||
return fin
|
||||
}
|
||||
|
||||
func main() {
|
||||
points := []Point{{1},{2},{3}}
|
||||
|
||||
for i := range points {
|
||||
points[i].Inc()
|
||||
}
|
||||
fmt.Println(points[0].x)
|
||||
Cakes(map[string]int{"flour": 500, "sugar": 200, "eggs": 1}, map[string]int{"flour": 1200, "sugar": 1200, "eggs": 5, "milk": 200})
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user