QOJ.ac

QOJ

実行時間制限: 5 s メモリ制限: 1024 MB 満点: 100

#4676. 合并的洋蓟

統計

Fatima Cynara 是 Amalgamated Artichokes (AA) 公司的一名分析师。和任何公司一样,AA 既有辉煌时期,也有低谷时期。Fatima 正在对 AA 的股票价格进行趋势分析,她想要确定在不同时间跨度内股票价格的最大跌幅。例如,如果一段时间内的股票价格依次为 19, 12, 13, 11, 20 和 14,那么最大跌幅为 8(发生在第一个价格和第四个价格之间)。如果最后一个价格是 10 而不是 14,那么最大跌幅将是 10(发生在最后两个价格之间)。

图片由 Hans Hillewaert 提供,来自维基共享资源

Fatima 通过之前的分析发现,任何时间段内的股票价格都可以用以下公式进行相当准确的建模:

$$\text{price}(k) = p \cdot (\sin(a \cdot k + b) + \cos(c \cdot k + d) + 2)$$

其中 $p, a, b, c$ 和 $d$ 为常数。Fatima 希望你编写一个程序,计算给定价格序列中的最大价格跌幅。图 A.1 展示了样例输入 1 的价格函数。你只需要考虑 $k$ 为整数时的价格。

图 A.1:样例输入 1。最大跌幅发生在第四个价格到第七个价格之间。

输入格式

输入包含一行,包含 6 个整数 $p$ ($1 \le p \le 1\,000$),$a, b, c, d$ ($0 \le a, b, c, d \le 1\,000$) 和 $n$ ($1 \le n \le 10^6$)。前 5 个整数如上所述。需要考虑的股票价格序列为 $\text{price}(1), \text{price}(2), \dots, \text{price}(n)$。

输出格式

输出股票价格的最大跌幅。如果没有跌幅,则输出 0。你的输出结果的绝对误差或相对误差应不超过 $10^{-6}$。

样例

输入格式 1

42 1 23 4 8 10

输出格式 1

104.855110477

输入格式 2

100 7 615 998 801 3

输出格式 2

0.00

输入格式 3

100 432 406 867 60 1000

输出格式 3

399.303813

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.