QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#7073. 绝对空间

Statistics

小明是一名小学生。有一天,他的数学老师指导学生们制作一系列特殊的模型,这些模型被称为“绝对空间”。每个模型由三维空间中的许多星星组成,并关联一个特殊参数 $n$,要求模型中的任意一颗星星,都有且仅有 $n$ 颗星星与其欧几里得距离为 1。

例如,对于 $n = 1$ 的情况,你可以通过画一条长度为 1 的线段,并在该线段的两个端点处放置星星来创建此模型。类似地,对于 $n = 2$,你可以通过画一个边长为 1 的正多边形(即等边三角形、正方形或正五边形),并在多边形的顶点处放置星星来创建此模型。如你所见,存在无穷多种“绝对空间”。

在课堂上,老师教了他们 $n = 1, 2$ 时的情况,而他们的家庭作业是为 $n = 3$ 创建一个模型。由于作业太简单了,小明不想止步于这些小情况。他花了一整晚思考,最终设法找到了适用于任何参数 $n$($n = 1, 2, 3, 4, 5, \dots$)的解。此外,他还找到了在创建这些模型时减少星星数量的方法。

如此巨大的进步既让他欣喜若狂,也让他彻夜难眠。第二天早上起床时,他完全忘记了自己是怎么想到的,而且由于他错误地使用了过期的胶水,他的草稿模型也坍塌了,所以他没有证据向老师证明他所做的一切。你能为这个可怜的小男孩创建一个模型吗?

给定参数 $n$,你的任务是创建一个可能的模型,使得星星的数量不超过某个限制。

输入格式

仅一行,包含一个整数 $n$($1 \le n \le 10$),表示模型的参数。

输出格式

第一行输出一个整数 $m$($1 \le m \le 100$),表示你模型中星星的数量。

接下来的 $m$ 行,每行输出一颗星星的坐标,即输出三个实数 $x, y, z$($-100 \le x, y, z \le 100$),表示在点 $(x, y, z)$ 处的一颗星星。此外,输出中的任意两点之间的欧几里得距离不得小于 0.01。

为了容忍精度误差,如果对于你模型中的每一颗星星,都有且仅有 $n$ 颗星星与其欧几里得距离在区间 $(0.999\,999, 1.000\,001)$ 内,则你的模型将被视为有效。

样例

输入 1

1

输出 1

2
0.000000000 0.000000000 0.000000000
1.000000000 0.000000000 0.000000000

输入 2

2

输出 2

3
0.000000000 0.000000000 0.000000000
1.000000000 0.000000000 0.000000000
0.500000000 0.866025404 0.000000000

输入 3

3

输出 3

4
0.500000000 0.000000000 -0.353553391
-0.500000000 0.000000000 -0.353553391
0.000000000 0.500000000 0.353553391
0.000000000 -0.500000000 0.353553391

输入 4

4

输出 4

6
0.707106781 0.000000000 0.000000000
-0.707106781 0.000000000 0.000000000
0.000000000 0.707106781 0.000000000
0.000000000 -0.707106781 0.000000000
0.000000000 0.000000000 0.707106781
0.000000000 0.000000000 -0.707106781

输入 5

5

输出 5

12
0.000000000 0.500000000 0.809016994
0.000000000 -0.500000000 0.809016994
0.000000000 0.500000000 -0.809016994
0.000000000 -0.500000000 -0.809016994
0.500000000 0.809016994 0.000000000
0.500000000 -0.809016994 0.000000000
-0.500000000 0.809016994 0.000000000
-0.500000000 -0.809016994 0.000000000
0.809016994 0.000000000 0.500000000
0.809016994 0.000000000 -0.500000000
-0.809016994 0.000000000 0.500000000
-0.809016994 0.000000000 -0.500000000

说明

对于样例: 长度为 1 的线段是 $n = 1$ 的可行模型; 等边三角形是 $n = 2$ 的可行模型; 正四面体是 $n = 3$ 的可行模型; 正八面体是 $n = 4$ 的可行模型; * 正二十面体是 $n = 5$ 的可行模型,如上图所示。

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.