当前位置: 代码迷 >> 综合 >> 3-cycles(翻译)
  详细解决方案

3-cycles(翻译)

热度:22   发布时间:2023-12-05 15:37:19.0

来源:https://codeforces.com/contest/41/problem/E

3-cycles

 

During a recent research Berland scientists found out that there were n cities in Ancient Berland, joined by two-way paths. Any two cities are joined by no more than one path. No path joins a city with itself. According to a well-known tradition, the road network was built so that it would be impossible to choose three cities from each of which one can get to any other one directly. That is, there was no cycle exactly as long as 3. Unfortunately, the road map has not been preserved till nowadays. Now the scientists are interested how much developed a country Ancient Berland was. Help them - find, what maximal number of roads could be in the country. You also have to restore any of the possible road maps.

Input

The first line contains an integer n (1?≤?n?≤?100) — the number of cities in Berland.

Output

On the first line must be printed number m — the maximal number of roads in Berland. Then print m lines containing two numbers each — the numbers of cities that the given road joins. The cities are numbered with integers from 1 to n. If there are several variants of solving the problem, print any of them.

Examples

input

Copy

3

output

Copy

2
1 2
2 3

input

Copy

4

output

Copy

4
1 2
2 3
3 4
4 1

翻译: 

?在最近的一项研究中,伯兰的科学家发现,古伯兰有??n??个城市,由双向路径连接。任何两个城市的连接路径不超过一条。没有一条路能将一座城市与它本身连接起来。根据一个众所周知的传统,道路网络的建立使得不可能从每个城市中选择三个城市,每个城市都可以直接到达任何其他城市。也就是说,没有一个周期恰好长于3。不幸的是,路线图直到今天才得到保存。现在科学家们对古代伯兰的一个国家有多发达感兴趣。帮助他们 - 找到,该国可能的最大道路数量。您还必须恢复任何可能的路线图。?

?输入?

?第一行包含一个整数 ??n?? (??1 ≤ ??n?? ≤ 100??) — 伯兰的城市数量。?

?输出?

?在第一行必须打印数字??m?? - 伯兰的最大道路数量。然后打印 ??m?? 行,每行包含两个数字 — 给定道路连接的城市数。城市用??从 1?? 到 ??n?? 的整数编号。如果解决问题有几种变体,请打印其中任何一种。?