程序设计能力实训

1112. 多次函数

单点时限: 2.0 sec

内存限制: 256 MB

在一个平面坐标系统中显示一个多次函数的图像。

为简化起见,设多次函数的最大幂次为 $3$,系数最多为 $2$ 位数。

函数表示为:$ f(x) = c_3 x \text{^} 3+c_2 x \text{^} 2 + c_1 x + c_0$。

给出的函数是最简形式。$c_i$ 为 1 时可省略,$c_3$ 为正数时可省略 +,幂次为 $1$ 时可省略 ^1

坐标系统的 x 轴和 y 轴范围限制在 $[-20,20]$,具体格式见样例。

输入格式

不多于 20 行,每行一个最多为 3 次的函数。形式:$f(x)=c_3 x \text{^} 3+c_2 x \text{^} 2 + c_1 x + c_0$。

输出格式

显示每个函数的图像。两个函数之间用一个空行分隔,最后一个函数之后没有空行。

样例

Input
f(x)=3x^2
f(x)=-5x
f(x)=1
Output
....................^....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
..................*.|.*..................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
...................*|*...................
....................|....................
....................|....................
--------------------*------------------->
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................

................*...^....................
....................|....................
....................|....................
....................|....................
....................|....................
.................*..|....................
....................|....................
....................|....................
....................|....................
....................|....................
..................*.|....................
....................|....................
....................|....................
....................|....................
....................|....................
...................*|....................
....................|....................
....................|....................
....................|....................
....................|....................
--------------------*------------------->
....................|....................
....................|....................
....................|....................
....................|....................
....................|*...................
....................|....................
....................|....................
....................|....................
....................|....................
....................|.*..................
....................|....................
....................|....................
....................|....................
....................|....................
....................|..*.................
....................|....................
....................|....................
....................|....................
....................|....................
....................|...*................

....................^....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
*****************************************
--------------------+------------------->
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................
....................|....................

提示

如果在表示坐标轴的 -|>^ 字符和表示原点的 + 字符位置需要显示 * 时,用 * 去覆盖。

不限期开放

题目列表