QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 64 MB مجموع النقاط: 100

#11050. 道路网络规划的计算

الإحصائيات

Byteman 准备开车环游 Byteland,但不幸的是他买不到该国的地图。他从朋友那里了解到关于 Byteland 公路网的一些特性:

  • Byteland 有 $n$ 个城市,编号从 $1$ 到 $n$。
  • 每条公路都是双向的,连接两个不同的城市。
  • 任意两个不同的城市之间都由且仅由一条路径相连,该路径由一条或多条公路组成,且路径上没有城市重复出现。
  • 最长的路径(路径上没有城市重复出现)由 $d$ 条公路组成。

利用他收集到的信息,Byteman 打算尝试重建 Byteland 的公路地图。满足给定条件的理论上可能的公路网方案总数可能非常大,因此任何一个正确的方案对 Byteman 来说都足够了。

请编写一个程序:

  • 从标准输入读取数字 $n$ 和 $d$。
  • 计算出任何一个符合 Byteman 所收集信息的公路网方案,或者判断不存在这样的方案。
  • 将结果写入标准输出。

输入格式

输入的第一行也是唯一一行包含两个整数 $n$ 和 $d$ ($2 \le n \le 200$, $0 \le d < n$),中间用单个空格分隔。

输出格式

如果对于输入的参数 $n$ 和 $d$ 不存在满足条件的公路网方案,则输出的第一行也是唯一一行应包含一个单词 BRAK(即波兰语中的“无”)。否则,输出应包含 $n - 1$ 行。每行应包含一条双向公路的描述——两个 $1$ 到 $n$ 之间的不同整数,中间用单个空格分隔,表示该公路连接的城市编号。输出中公路的顺序以及每条公路连接的城市编号顺序可以是任意的。

样例

输入 1

6 3

输出 1

1 3
2 3
3 4
4 5
4 6

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.