PLOT1 - Plotting functions (variation)

no tags 

Given a function y=f(x) in RPN-notation 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'. Items are separated by space.

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:
1
x 1 - Output: .....................
....................*
...................*.
..................*..
.................*...
................*....
...............*.....
..............*......
.............*.......
............*........
...........*.........
..........*..........
.........*...........
........*............
.......*.............
......*..............
.....*...............
....*................
...*.................
+++++++++++++++++++++
.*...................

hide comments
salvanse: 2023-11-11 13:20:31

can anyone give me the output from Divanshu: 2011-11-30 08:42:55\
2
x 1 -
x 2 ^

(Tjandra Satria Gunawan)(曾毅昆): 2012-09-17 15:18:17

The f(x) format is not like this:
variable/number variable/number operator

numerix: 2012-09-17 13:47:04

Input data is okay and formatted as explained in the description.

(Tjandra Satria Gunawan)(曾毅昆): 2012-09-16 09:51:01

getting NZEC, I don't know the input formatting. Seems that it not like the example given above... :-(

Divanshu: 2011-11-30 08:42:55

can anyone give some more test cases?
I'm getting right answer for :
2
x 1 -
x 2 ^
Still getting WA !

Andrey Fedorov: 2011-10-03 14:55:57

@ HWK: Thank you very much:)

HWK: 2011-10-03 12:16:17

@Andrey Fedorov: Make dx even smaller!
I've decreased it in your 5753568 and immediately got AC.

Last edit: 2011-10-03 12:20:54
HWK: 2011-10-01 09:44:07

@Andrey Fedorov: Your problem are the derivations. Think about dx e.g. in your last solution. ;-)

HWK: 2011-09-30 12:01:26

In:
1
x 2 ^
Out:
..........+..........
.....................
.........+...........
.....................
....*...+............
.....................
.......+.............
.....................
......+..............
.....................
.....+...............
...*.................
....+................
.....................
...+.................
.....................
..+..................
.....................
.+...................
.*...................
+....................

btw: Your 5750827 is really good. Only one mistake with a derivation.

Last edit: 2011-09-30 12:14:22
Andrey Fedorov: 2011-09-30 07:31:50

Hi!
If I draw f(x) = x*x, do I need to fill points with y in {2,3,5,6,7...} ?


Added by:HWK
Date:2011-03-02
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64