Update exam/packet.tex
This commit is contained in:
@@ -157,7 +157,7 @@ You are given a string S composed of only the characters 6, 7, A, B, and \# (wit
|
||||
|
||||
\inputformat
|
||||
\begin{itemize}
|
||||
\item The first line consists of the string S. The string consists only of the characters 6, 7, A, B, and \#.
|
||||
\item The first line consists of the string $S$ ($1 \leq |S| \leq 10^5$). The string consists only of the characters 6, 7, A, B, and \#.
|
||||
\end{itemize}
|
||||
|
||||
\outputformat
|
||||
@@ -202,7 +202,7 @@ Your task is to determine if there exists any valid path from (1,1) to (N,M) obe
|
||||
|
||||
\inputformat
|
||||
\begin{itemize}
|
||||
\item The first line consists 2 integers N and M ($1 \leq N, M \leq 10^9$), the number of rows and columns, respectively
|
||||
\item The first line consists 2 integers $N$ and $M$ ($1 \leq N, M \leq 10^9$), the number of rows and columns, respectively
|
||||
\item The next N lines will consist of strings of length M, containing 6 or 7
|
||||
\end{itemize}
|
||||
|
||||
@@ -248,7 +248,7 @@ There is a staircase with N steps. Each step is labelled with a 6 or a 7. Simon
|
||||
|
||||
\inputformat
|
||||
\begin{itemize}
|
||||
\item The first line consists an integer N($1 \leq N \leq 10^5$), the number of steps
|
||||
\item The first line consists an integer $N$ ($1 \leq N \leq 10^5$), the number of steps
|
||||
\item The second line will consist of N integers, the label of each step (either 6 or 7)
|
||||
\end{itemize}
|
||||
|
||||
@@ -299,13 +299,13 @@ There is a staircase with N steps. Each step is labelled with a 6 or a 7. Simon
|
||||
\textit{Difficulty: Medium}
|
||||
|
||||
We all know that CS students don't shower often. In fact, Simon showers about 6 to 7 times every year, a practice of discipline and optimization. To motivate himself to shower, Simon invented a mini-game involving a sequence made only of 6s and 7s.
|
||||
Before every shower, Simon stares at the sequence and simulates a “cleaning process.” He believes that every time he cleans up the sequence, he cleans up his soul enough to deserve a shower.\newline\newline
|
||||
Before every shower, Simon stares at the sequence and simulates a “cleaning process.” He believes that every time he cleans up the sequence, he cleans up his soul enough to deserve a shower.
|
||||
The sequence S of length N consisting only of 6 and 7.\newline\newline
|
||||
Simon scans the string left to right. Whenever he encounters the pattern “67”, he considers that a sign of impurity since the 6 is “dirtier” than the 7, so they must be flipped to “76” on the spot. This change happens immediately because Simon believes cleanliness must spread instantly. After reaching the end, Simon restarts the sweep from the beginning, repeating passes until there are no more “67” pairs, meaning the sequence has reached maximum spiritual hygiene. Your task is to determine the number of flips Simon must do to achiece spiritual hygiene.
|
||||
|
||||
\inputformat
|
||||
\begin{itemize}
|
||||
\item The first line consists an integer N($1 \leq N \leq 10^9$), the length of the sequence
|
||||
\item The first line consists an integer $N$ ($1 \leq N \leq 10^9$), the length of the sequence
|
||||
\item The second line will consist of a string S, with length N
|
||||
\end{itemize}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user