3-cycles(翻译)

来源: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‎‎ 的整数编号。如果解决问题有几种变体,请打印其中任何一种。‎

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值