Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

PLOT - Plotting functions

Given a function y=f(x) plot it with stars (*) and then (!) its derivation with crosses (+) for 0<=x<=20 with Δx=1 in a diagram with 21*21 points (0<=x,y<=20). Empty fields are marked with dots (.). For plotting the real number y should be rounded to integer (-0.5 -> -1, -0.4 -> 0, 0.4 -> 0, 0.5 -> 1). The function and its derivation are continuous between 0 and 20.
The function definition uses only the following characters: 0123456789x.+-*/()
'**' means 'power of'.

See also this similar task.

Input

In the first line the number N of functions, then N lines with one function.

Output

The plot of each function and its derivation in 21 lines.

Example

Input:
2
x
20/(x+1) Output: ....................*
...................*.
..................*..
.................*...
................*....
...............*.....
..............*......
.............*.......
............*........
...........*.........
..........*..........
.........*...........
........*............
.......*.............
......*..............
.....*...............
....*................
...*.................
..*..................
+++++++++++++++++++++
*....................

*....................
.....................
.....................
.....................
.....................
.....................
.....................
.....................
.....................
.....................
.*...................
.....................
.....................
..*..................
.....................
...*.................
....*................
.....***.............
........*****........
.............********
......+++++++++++++++

Added by:HWK
Date:2011-03-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi

hide comments
2014-04-03 23:46:09 Piotr KÄ…kol
I took it from HWK's Ruby code. Thought that it was a random one, but it seems now that it's calculated somehow.
2014-03-31 15:51:06 numerix
@Piotr: Is this "my" constant or did you find out by yourself ...?
2014-03-31 03:12:17 Linghui Liu
@piotr @jander, thanks!
2014-03-31 02:07:45 Piotr KÄ…kol
Well, I hope other users won't kill me for saying this, but I got AC in Linghui's AWK and Python codes with delta=0.000000003.
2014-03-30 18:11:05 Linghui Liu
I tried some dx from 10^-1 to 10^-10, but all failed.
2014-03-30 17:11:08 weltfremd
I don't even know if I'm having precision problems, or if there's a more fundamental issue with the way I'm going at this...
A non-integer exponent would mean it couldn't work at all.
Any hints? ;)

Last edit: 2014-03-30 17:16:39
2014-03-30 17:06:40 Jander
@Piotr - HWK and I spent quite some time discussing the problem of precision on IRC.
2014-03-30 13:25:00 Piotr KÄ…kol
Yup, it's a precision matter. Your program fails for test:
(polynomial of 3 degree)/constant
2014-03-30 13:02:14 Jander
@Linghui Liu - The usual problem is the accuracy of derivation.
2014-03-30 06:40:43 Linghui Liu
@piotr, what's wrong with my code (#11356161)?

Last edit: 2014-03-30 06:56:51
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.