Submit | All submissions | Best solutions | Back to list |
HS08SUAN - Suan Pan |
Johnny's fabulous birthday party turned out more costly than he had expected. So, once again, he ran to Leo's shop, this time asking for a holiday job. Leo agreed to hire Johnny, but he expects that Johnny learns to operate the abacus which Leo uses for totting up bills - as soon as possible!
Leo's first task for Johnny was as follows. The old man said:
"Here is a Chinese abacus which you can use for calculations both in the decimal system, and in the hexadecimal system. Successive digits in the hexadecimal system are represented by successive columns of the abacus, starting from the right. In each of the upper rows one bead has a value of 5, in each of the lower rows - a value of 1. Your task is to represent a decimal number, given on a sheet of paper, in the form of a hexadecimal number on the abacus. You must do all the necessary arithmetic yourself, assisted only the abacus, if you wish."
Help Johnny find a solution to his problem!
Input
Every data set consists of one positive integer D given in the decimal system with at most 30 digits.
Output
Write to output the correct state of the Chinese abacus, representing the value of D in the hexadecimal system. Assume that the number of columns of the abacus is equal to 30.
Example 1
Input: 251 Output: ------------------------------ oooooooooooooooooooooooooooo oooooooooooooooooooooooooooooo oo ------------------------------ oo ooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo o ------------------------------
Example 2
Input: 28724239499488423 Output: ------------------------------ ooooooooooooooooooo o o o o oooooooooooooooo oo ooooo oo oo ooo ooooooo ------------------------------ oo ooooooooo o oooooooooooooooo ooo o oo ooo ooooooooooooooooooo oo o oo o oooooooooooooooooooo ooooooooo oooooooooooooooooooooooooooooo ooooooooooooooooooooooooo oooo ------------------------------
Scoring
For every test data you can get 1, 2 or 3 points, summing to a total of 10 points.
Added by: | mima |
Date: | 2008-10-22 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: CLOJURE ERL JS-RHINO PERL6 |
Resource: | High School Programming League 2008/2009 |