Submit | All submissions | Best solutions | Back to list |
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 |