#C2021. Taco Transformation Game
Taco Transformation Game
Taco Transformation Game
Alice and Bob are playing a transformation game with strings. Given an integer N and two strings of length N called initial
and target
, in each turn a player may change one differing character. The moves alternate between the players. Alice wins if, after a minimum number of turns, the initial
string is transformed into the target
string on her move.
Your task is to determine the minimum number of turns required such that Alice wins. The answer is calculated based on the number of positions at which the two strings differ. Let \( d \) be the number of indices where initial[i]
\( \neq \) target[i]
. Then, the minimum number of turns required is:
[ \text{result} = \left\lceil \frac{d}{2} \right\rceil ]
Note that the ceiling function is equivalent to computing \( \frac{d+1}{2} \) with integer division.
inputFormat
The input consists of three lines:
- The first line is an integer N representing the length of the strings.
- The second line is the
initial
string. - The third line is the
target
string.
outputFormat
Output a single integer representing the minimum number of turns required for Alice to win.
## sample4
abca
bcda
2