DWITE '12 R1 #2 - Candybar Graphs

View as PDF

Submit solution

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
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 candy part, followed by periods . for the candy-free houses.

Sample Input

0 1
1 9
19 81
99 1
1 0

Sample Output


Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Problem Resource: DWITE


There are no comments at the moment.