This commit is contained in:
a.pivkin 2026-01-11 11:05:35 +03:00
parent 2e763f0dd6
commit 410010a974

View File

@ -2,19 +2,19 @@ package main
import "fmt" import "fmt"
type Point struct { func Cakes(recipe, available map[string]int) int {
x int fin := 100000
} for k := range recipe {
fmt.Printf("recipe[k] is %d and available[k] is %d\n", recipe[k], available[k])
func (p *Point) Inc() { temp := available[k] / recipe[k]
p.x++ if temp < fin {
fin = temp
}
}
fmt.Println(fin)
return fin
} }
func main() { func main() {
points := []Point{{1},{2},{3}} Cakes(map[string]int{"flour": 500, "sugar": 200, "eggs": 1}, map[string]int{"flour": 1200, "sugar": 1200, "eggs": 5, "milk": 200})
for i := range points {
points[i].Inc()
}
fmt.Println(points[0].x)
} }