SciComLove (2023)
InterviewTime limit2sMemory limit1024 MB
Given the prefix of length N of the repeated string SciComLove, flip the case of one character per query and print the uppercase count after each query.
- Level
Easy2 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
The math rabbit's favorite string is "SciComLove" (without the quotes). The rabbit loves it so much that it extended the string to length . The string becomes the prefix of length of the infinitely repeated "SciComLove". For example, if , the string is "SciComLoveSciCo".
The rabbit plays with this string over rounds. The -th round goes as follows.
- Flip the -th character of the string: an uppercase letter becomes lowercase, and a lowercase letter becomes uppercase. (Here )
After each of the rounds, write a program that prints the number of uppercase letters in the string. All changes accumulate.
Input
The first line contains two integers and , separated by a space. From the second line through line , each of the lines contains one integer , , , .
Output
After each of the rounds, print the number of uppercase letters in the current string on its own line.
Constraints
- ()