Update exam/packet.tex

This commit is contained in:
2025-11-28 12:25:22 -06:00
parent b2c580746b
commit bc5c2e6898

View File

@@ -299,15 +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 cycle, 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
You are given a string S of length N consisting only of 6 and 7.\newline\newline
Simon scans the string left to right, performing what he calls a “pre-rinse sweep." Whenever Simon encounters the pattern “67”, he considers that a sign of impurity —
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.
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
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 2 * 10^5$), 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}