QOJ.ac

QOJ

时间限制: 2.0 s 内存限制: 512 MB 总分: 100 可 Hack ✓

#8795. 神秘序列

统计

在数字的古老王国中,存在着一个神秘的公式,它将序列中的每个数字与前两个数字连接起来:

$$X_{i+2} = A \cdot X_{i+1} + B \cdot X_i$$

这个公式威力巨大,以至于即使是最聪明的魔法师,在不知道前两个数字的情况下也无法推算出序列中的所有数字。

然而,随着时间的流逝,除了第一个和最后一个数字外,序列中的所有成员都已丢失。

很久以前,一位最高等级的巫师被要求找出这个神秘序列中的所有数字 $X_i$。他踏上了一段漫长的旅程,深入钻研咒语和数学公式。凭借他的知识和魔法,他探究了数字的秘密,并最终揭示了隐藏在这个神秘公式中的所有 $X_i$。

那么你呢?你能仅凭第一个和最后一个数字,还原出序列中的所有成员吗?

输入格式

第一行包含实数 $A$ 和 $B$($0.25 \le A, B \le 1$,小数点后最多两位)以及整数 $n, X_1, X_n$($2 \le n \le 10$,$1 \le X_1, X_n \le 100$)。

输出格式

输出 $n$ 行:即数字 $X_1, X_2, \dots, X_n$,每行一个。如果绝对误差或相对误差不超过 $10^{-6}$,则答案被视为正确。

样例

样例输入 1

1.0 1.0 10 1 10

样例输出 1

1
-0.3235294118
0.6764705882
0.3529411765
1.029411765
1.382352941
2.411764706
3.794117647
6.205882353
10

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.