package main import ( "fmt" "sort" ) func main() { broters := make([]human, 3) broters[0].name = "A" broters[1].name = "B" broters[2].name = "C" for i := 0; i < 3; i++ { fmt.Scan(&broters[i].high) fmt.Scan(&broters[i].weight) } sort.Slice(broters, func(i, j int) bool { if broters[i].high > broters[j].high { return true } else if broters[i].high == broters[j].high { return broters[i].weight < broters[j].weight } else { return false } }) for i := 0; i < 3; i++ { fmt.Println(broters[i].name) } } type human struct { name string high int weight int }