UVa 10800

From Algorithmist
Jump to: navigation, search

10800 - Not That Kind of Graph[edit]

Summary[edit]

We have to draw an ASCII line graph of a stock prize. Given the title, it's easy to see that this is the only problem not related to Graph Theory in the given set.

Explanation[edit]

The problem explanation covers the problem with enough detail to solve it without really needing much insight. We are given a string of characters, each which is R (rise), C (constant) or F (fall) and have to draw the corresponding line. Just make a 2d matrix of characters and draw to the matrix, and then output the matrix.

Gotcha's[edit]

  • The stock price does not necessarily start its minimum
  • Don't output spaces at the end of the line

Input[edit]

15
RRRCFCRFRFFCCCR
RRR
CCCCCC
CRCFRCFRRFR
CRRRFCFRCFRFC
RCRFCRFFCCRRC
RRRFFFFFFFFFF
RCRFCRFFCCRRC
FCFCCFRRCCFFC
RCRFCRFFCCRRC
R
F
C
RFRFRFCCCRF
FFF

Output[edit]

Case #1:
|    _
|   / \_/\/\
|  /        \___/
| /
+-----------------

Case #2:
|   /
|  /
| /
+-----

Case #3:
| ______
+--------

Case #4:
|   _  _  /\/
| _/ \/ \/
+-------------

Case #5:
|    /\_  _
|   /   \/ \/\_
| _/
+---------------

Case #6:
|             _
|  _/\_/\    /
| /      \__/
+---------------

Case #7:
|   /\
|  /  \
| /    \
|       \
|        \
|         \
|          \
|           \
|            \
|             \
+---------------

Case #8:
|             _
|  _/\_/\    /
| /      \__/
+---------------

Case #9:
| \_      __
|   \__  /  \
|      \/    \_
+---------------

Case #10:
|             _
|  _/\_/\    /
| /      \__/
+---------------

Case #11:
| /
+---

Case #12:
| \
+---

Case #13:
| _
+---

Case #14:
| /\/\/\___/\
+-------------

Case #15:
| \
|  \
|   \
+-----