spoj#ZOOMOP2. Zoom Operation
Zoom Operation
Zoom Operation:
Use only 4 symbols: + ? - # (in circular order beginning with + ) to zoom the number given.
Every segment of the number has one symbol more than the previous.(First Segment has a single symbol).
First symbol of evry segment starts in the same column/row where the previous segments' last symbol ends.
1st segment(orange color) -> 1 symbol + (first symbol only)
2nd segment(green color) -> 2 symbols ? - (starts with 2nd symbol as 1st segment uses sinlge element)
3rd segment(yellow color) -> 3 symbols # + ? (starts with 4th symbol as 3 symbols have been used)
Colors are shown for better understanding.See Picture for more clarification.
Input:
Given a number you have to apply Zoom operation and print it.
Output:
Print the Pattern after Zoom Operation.
Example:
Input:
1
Output:
+
Input:
2
Output:
+?
-
-?+#
#
+
?
-#+?-
Input:
3
Output:
+?
-
-?+#
#
+
?
-#+?-#
+
?
-
#
+
#-?+#-?
Input:
4
Output:
+
?-#
+
?
Input:
5
Output:
?+
-
#+?-
#
+
?
-?+#-
For any clarification,refer to the picture above.
Try tutorial at -> http://www.spoj.com/problems/ZOOMOP/