#K45307. Tournament Schedule

    ID: 27724 Type: Default 1000ms 256MiB

Tournament Schedule

Tournament Schedule

You are given an integer N representing the number of players in a tournament. Each player must play against every other player exactly once. Your task is to compute the total number of matches and output a unique schedule of matches.

The total number of matches is given by the formula:

\(\frac{N \times (N-1)}{2}\)

The schedule should list each match as a pair of player identifiers. Players are numbered from 1 to N. Each pair should appear only once in the form (i, j) where i < j.

If there are fewer than 2 players, no matches will be played.

inputFormat

The input consists of a single integer N (where N ≥ 0), provided via standard input.

outputFormat

Output the total number of matches on the first line. If there are any matches, then output each match on a new line as two space-separated integers i and j representing a match between player i and player j, where i < j. All output should be printed to standard output.

## sample
4
6

1 2 1 3 1 4 2 3 2 4 3 4

</p>