Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- times := []string{"Corinthians", "Londrina", "Operário", "Leicester"}
- calendario := [][]string{}
- lenTimes := len(times)
- lenTimes2 := lenTimes / 2
- for y := 1; y < lenTimes; y++ {
- for i, x := 0, lenTimes2; i < lenTimes2; i, x = i+1, x+1 {
- calendario = append(calendario, []string{times[i], times[x]})
- }
- t := y + 1
- if t == lenTimes {
- t = 0
- }
- times[y], times[t] = times[t], times[y]
- }
- for _, rodada := range calendario {
- fmt.Printf("%s x %s\n", rodada[0], rodada[1])
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement