// No.750 Frac #1 package main import ( "fmt" "sort" ) func main() { var n int fmt.Scan(&n) type target struct { molecule int denominator int decimal float64 } t := make([]target, n) for i := 0; i < n; i++ { fmt.Scan(&t[i].molecule, &t[i].denominator) t[i].decimal = float64(t[i].molecule) / float64(t[i].denominator) } sort.Slice(t, func(i, j int) bool { return t[i].decimal > t[j].decimal }) for _, tt := range t { fmt.Println(tt.molecule, tt.denominator) } }