← Home
```go
package main

import (
	"fmt"
	"math"
)

func main() {
	var x, y, n int
	fmt.Scan(&x, &y, &n)

	bestA := 0
	bestB := 1
	bestDiff := math.Abs(float64(x)/float64(y) - float64(bestA)/float64(bestB))

	target := float64(x) / float64(y)

	for b := 1; b <= n; b++ {
		// Find the best a for this b
		// a/b closest to x/y => a = round(x*b/y)
		aFloat := target * float64(b)
		aLow := int(math.Floor(aFloat))
		
		for _, a := range []int{aLow, aLow + 1} {
			if a < 0 {
				a = 0
			}
			diff := math.Abs(target - float64(a)/float64(b))
			if diff < bestDiff || (diff == bestDiff && b < bestB) || (diff == bestDiff && b == bestB && a < bestA) {
				bestDiff = diff
				bestA = a
				bestB = b
			}
		}
	}

	fmt.Printf("%d/%d\n", bestA, bestB)
}
```