Update exam/packet.tex
This commit is contained in:
117
exam/packet.tex
117
exam/packet.tex
@@ -145,15 +145,16 @@ Output:
|
||||
% ========================= Problem 6 =========================
|
||||
\problem{Problem 6(.7): Sequencing}
|
||||
\textit{Difficulty: Easy}
|
||||
\begin{itemize}
|
||||
You are given a string S composed of only the characters ‘6', ‘7’, ‘A', ‘B', and ‘\#' (without the quotation marks). This string is processed from left to right, and you must maintain a sequence of chracters that changes according to these rules:
|
||||
|
||||
You are given a string S composed of only the characters 6, 7, A, B, and \# (without the quotation marks). This string is processed from left to right, and you must maintain a sequence of chracters that changes according to these rules:
|
||||
\begin{itemize}
|
||||
\item 6 - add a 6 to the end of the sequence
|
||||
\item 7 - if the sequence is non-empty and its last chracter is ‘6', remove that last ‘6', otherwise, add ‘7' to the end of the sequence
|
||||
\item 7 - if the sequence's last chracter is 6, remove that last 6, otherwise, add 7 to the end of the sequence
|
||||
\item A - reverse the sequence
|
||||
\item B - add a duplicate of the current sequence to the end of it
|
||||
\item \# - clear the sequence
|
||||
\end{itemize}
|
||||
|
||||
\inputformat
|
||||
\begin{itemize}
|
||||
\item The first line consists of the string S. The string consists only of the characters 6, 7, A, B, and \#.
|
||||
@@ -166,23 +167,23 @@ You are given a string S composed of only the characters ‘6', ‘7’, ‘A',
|
||||
|
||||
\examples
|
||||
\begin{verbatim}
|
||||
Input 1:
|
||||
67A6
|
||||
Input 1:
|
||||
67A6
|
||||
|
||||
Output 1:
|
||||
6
|
||||
Output 1:
|
||||
6
|
||||
|
||||
Input 2:
|
||||
66B7
|
||||
Input 2:
|
||||
66B7
|
||||
|
||||
Output 2:
|
||||
666
|
||||
Output 2:
|
||||
666
|
||||
|
||||
Input 3:
|
||||
7A7#
|
||||
Input 3:
|
||||
7A7#
|
||||
|
||||
Output 3:
|
||||
EMPTY
|
||||
Output 3:
|
||||
EMPTY
|
||||
\end{verbatim}
|
||||
|
||||
% ========================= Problem 7 =========================
|
||||
@@ -212,30 +213,30 @@ Your task is to determine if there exists any valid path from (1,1) to (N,M) obe
|
||||
|
||||
\examples
|
||||
\begin{verbatim}
|
||||
Input 1:
|
||||
2 2
|
||||
66
|
||||
67
|
||||
Input 1:
|
||||
2 2
|
||||
66
|
||||
67
|
||||
|
||||
Output 1:
|
||||
Sixxx sevennn
|
||||
Output 1:
|
||||
Sixxx sevennn
|
||||
|
||||
Input 2:
|
||||
2 2
|
||||
77
|
||||
77
|
||||
Input 2:
|
||||
2 2
|
||||
77
|
||||
77
|
||||
|
||||
Output 2:
|
||||
Six was afraid of seven after all
|
||||
Output 2:
|
||||
Six was afraid of seven after all
|
||||
|
||||
Input 3:
|
||||
3 3
|
||||
666
|
||||
676
|
||||
666
|
||||
Input 3:
|
||||
3 3
|
||||
666
|
||||
676
|
||||
666
|
||||
|
||||
Output 3:
|
||||
Sixxx sevennn
|
||||
Output 3:
|
||||
Sixxx sevennn
|
||||
\end{verbatim}
|
||||
|
||||
% ========================= Problem 8 =========================
|
||||
@@ -258,38 +259,38 @@ There is a staircase with N steps. Each step is labelled with a 6 or a 7. Simon
|
||||
|
||||
\examples
|
||||
\begin{verbatim}
|
||||
Input 1:
|
||||
5
|
||||
66766
|
||||
Input 1:
|
||||
5
|
||||
66766
|
||||
|
||||
Output 1:
|
||||
3
|
||||
Output 1:
|
||||
3
|
||||
|
||||
Explanation 1:
|
||||
Case 1: Step 1->2->3->4->5
|
||||
Case 2: Step 1->2->4->5
|
||||
Case 3: Step 1->3->4->5
|
||||
Explanation 1:
|
||||
Case 1: Step 1->2->3->4->5
|
||||
Case 2: Step 1->2->4->5
|
||||
Case 3: Step 1->3->4->5
|
||||
|
||||
Input 2:
|
||||
3
|
||||
677
|
||||
Input 2:
|
||||
3
|
||||
677
|
||||
|
||||
Output 2:
|
||||
2
|
||||
Output 2:
|
||||
2
|
||||
|
||||
Explanation 2:
|
||||
Case 1: 1->2->3
|
||||
Case 2: 1->3
|
||||
Explanation 2:
|
||||
Case 1: 1->2->3
|
||||
Case 2: 1->3
|
||||
|
||||
Input 3:
|
||||
1
|
||||
6
|
||||
Input 3:
|
||||
1
|
||||
6
|
||||
|
||||
Output 3:
|
||||
1
|
||||
Output 3:
|
||||
1
|
||||
|
||||
Explanation 3:
|
||||
There is only one way to get to the top (which Simon is already at).
|
||||
Explanation 3:
|
||||
There is only one way to get to the top (which Simon is already at).
|
||||
\end{verbatim}
|
||||
\end{document}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user