atcoder#AGC032B. [AGC032B] Balanced Neighbors

[AGC032B] Balanced Neighbors

Score : 700700 points

Problem Statement

You are given an integer NN. Build an undirected graph with NN vertices with indices 11 to NN that satisfies the following two conditions:

  • The graph is simple and connected.
  • There exists an integer SS such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is SS.

It can be proved that at least one such graph exists under the constraints of this problem.

Constraints

  • All values in input are integers.
  • 3N1003 \leq N \leq 100

Input

Input is given from Standard Input in the following format:

NN

Output

In the first line, print the number of edges, MM, in the graph you made. In the ii-th of the following MM lines, print two integers aia_i and bib_i, representing the endpoints of the ii-th edge.

The output will be judged correct if the graph satisfies the conditions.

3
2
1 3
2 3
  • For every vertex, the sum of the indices of the vertices adjacent to that vertex is 33.