Drill

ProblemsGo › production

Overall equipment effectiveness

mediumproductionMathGo

OEE multiplies three percentages together into one number that plant managers compare across lines.

oeeScore(availability: int, performance: int, quality: int) → int

Go needs a compiler and Drill does not host one yet, so this page is the reference rather than an exercise: the problem, worked examples, and the solution in full. To type it out, the same problem runs in Python.

Solve it in Python →

Where you start

func oeeScore(availability int, performance int, quality int) int {
	
}

Worked examples

CallResult
oeeScore(90, 95, 99)85
oeeScore(100, 100, 100)100
oeeScore(0, 100, 100)0
oeeScore(150, 100, 100)100

Hint

Clamp all three first, then multiply and divide by 10000 — adding 5000 before the divide rounds it.

Reference solution in Go
func oeeScore(availability int, performance int, quality int) int {
	c := func(v int) int {
		if v < 0 {
			return 0
		}
		if v > 100 {
			return 100
		}
		return v
	}
	return (c(availability)*c(performance)*c(quality) + 5000) / 10000
}

The same problem in another language

More production problems in Go