DWITE '09 R5 #1 - ASCII bar graphs

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
DWITE Online Computer Programming Contest, March 2010, Problem 1

The input will contain 5 lines, integers -5 \le N \le 5.

The output will plot the numbers as a graph. Each whole number gets an asterisk *; negative on the left of the central line drawn with pipes |, positive on the right. 0 does not get drawn. Empty spaces are filled with the minus sign - for alignment. See the sample graph for an example.

Sample Input

-5
-4
0
1
3

Sample Output

*****|-----
-****|-----
-----|-----
-----|*----
-----|***--

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments

There are no comments at the moment.