DWITE '12 R1 #2 - Candybar Graphs

View as PDF

Submit solution

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

Problem type
DWITE, October 2012, Problem 2

Besides candy, you have also collected data on how many houses gave out candy on each street. Having this in a handy chart would significantly optimize your candy gathering next year!

The input will contain 5 lines, each a pair of non-negative integers, separated by a single space. The first is the number of houses that gave out candy on that street. The second is the number of houses that did not. There will be at least one house on each street.

The output will contain 5 ASCII percent bar graphs — the ratio of candy-giving houses. Each line will be 10 characters long, and percents will be rounded to the lowest 10th. E.g. 19\% and 10\% both round down to 10\%. Use asterisk * for the candy part, followed by periods . for the candy-free houses.

Sample Input

0 1
1 9
19 81
99 1
1 0

Sample Output

..........
*.........
*.........
*********.
**********

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments

There are no comments at the moment.