链接:https://acs.jxnu.edu.cn/problem/HDU1016
题目:
描述:
A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.
Note: the number of first circle should always be 1.输入:
n (0 < n < 20).
输出:
The output format is shown as sample below. Each row represents a series of circle numbers in the ring beginning from 1 clockwisely and anticlockwisely. The order of numbers must satisfy the above requirements. Print solutions in lexicographical order.
You are to write a program that completes above process.
Print a blank line after each case.
翻译如下
描述:
有一个图形是由n个圆串起来的环组成的。将自然数1,2,...,n分别放入每一个圆里,并且相邻的两个圆里面的数字的合必须是质数。
注意,第一个圆里的数字必须为1。
输入:
n (0 < n < 20).
输出:
输出格式如下。每一行表示存在的解法,每个解法必须由1开头,并且顺序对应逆时针排序的图。(图中的解法表示为1 4 3 2 5 6).数字的排序必须满足以上的要求。请按字典序输出所有的解法。你需要编写一个程序来完成以上任务。
每两个样例之间需要有一个空行将其隔开。